473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

2 Dare (xmlschema question)

Hello, All!

It seems the bug
(http://groups.google.com/groups?hl=r...3b01c28a00%242
08bc860%2439ef2ecf%40TKMSFTNGXA08&rnum=8&prev=/groups%3Fq%3DschemaLocation%2
BXmlSchema%2B.NET%26hl%3Dru%26lr%3D%26ie%3DUTF-8%26selm%3Da53b01c28a00%25242
08bc860%252439ef2ecf%2540TKMSFTNGXA08%26rnum%3D8) wasn't fixed neither in
v1.1 nor in v2.0.

Here is exception

Unhandled Exception: System.Xml.Schema.XmlSchemaException: Cannot resolve
schema Location attribute.
at Modile1.ValidationSchemaCallBack(Object sender, ValidationEventArgs e)
at System.Xml.Schema.BaseProcessor.SendValidationEven t(XmlSchemaException
e, XmlSeverityType severity)
at System.Xml.Schema.SchemaCollectionPreprocessor.Loa dExternals(XmlSchema
schema, XmlSchemaCollection xsc)
at System.Xml.Schema.SchemaCollectionPreprocessor.Exe cute(XmlSchema
schema, String targetNamespace, Boolean loadExternals, XmlSchemaCollection
xsc)
at System.Xml.Schema.XmlSchema.CompileSchema(XmlSchem aCollection xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEventHandler validationEventHandler, XmlNameTable nameTable,
Boolean CompileContentModel)
at System.Xml.Schema.XmlSchema.Compile(ValidationEven tHandler
validationEventHandler)

Moreover, new XmlSchemaSet class, i'm afraid, have the same bug. I must
explicitly add all included schemas via Add method to get it work.

What i want is automatic addition all included schemas into the schema set.

With best regards, Alex Shirshov.
Nov 12 '05 #1
2 1878
The XmlSchemaSet does use the baseUri of the main schema to locate its
imports and includes.

The problem might be related to how you add your main schema to the
XmlSchemaSet. If you add the main schema by using the overload that takes in
XmlReader and you created the XmlTextReader by passing in a stream (and did
not pass in the baseUri of the file)
then, the baseUri of the main schema would be string.Empty.

Stream fileStream = File.OpenRead(url);
XmlTextReader reader = new XmlTextReader(fileStream);
XmlSchemaSet set = new XmlSchemaSet();
set.Add(null, reader);
Console.WriteLine(set.Count);

If the schema is loaded as shown above, the baseUri of the main schema is
string.Empty as XmlTextReader accepts baseUri only when the corresponding
overload is used.
XmlTextReader reader = new XmlTextReader(mySchemaUrl, fileStream);

or add the schema to the set passing in the url directly.

Thanks,
Priya

"Alex Shirshov" <no****@mail.ru> wrote in message
news:Oy******************@TK2MSFTNGP09.phx.gbl...
Hello, All!

It seems the bug
(http://groups.google.com/groups?hl=r...3b01c28a00%242 08bc860%2439ef2ecf%40TKMSFTNGXA08&rnum=8&prev=/groups%3Fq%3DschemaLocation%2 BXmlSchema%2B.NET%26hl%3Dru%26lr%3D%26ie%3DUTF-8%26selm%3Da53b01c28a00%25242 08bc860%252439ef2ecf%2540TKMSFTNGXA08%26rnum%3D8) wasn't fixed neither in
v1.1 nor in v2.0.

Here is exception

Unhandled Exception: System.Xml.Schema.XmlSchemaException: Cannot resolve
schema Location attribute.
at Modile1.ValidationSchemaCallBack(Object sender, ValidationEventArgs e) at System.Xml.Schema.BaseProcessor.SendValidationEven t(XmlSchemaException e, XmlSeverityType severity)
at System.Xml.Schema.SchemaCollectionPreprocessor.Loa dExternals(XmlSchema schema, XmlSchemaCollection xsc)
at System.Xml.Schema.SchemaCollectionPreprocessor.Exe cute(XmlSchema
schema, String targetNamespace, Boolean loadExternals, XmlSchemaCollection
xsc)
at System.Xml.Schema.XmlSchema.CompileSchema(XmlSchem aCollection xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEventHandler validationEventHandler, XmlNameTable nameTable,
Boolean CompileContentModel)
at System.Xml.Schema.XmlSchema.Compile(ValidationEven tHandler
validationEventHandler)

Moreover, new XmlSchemaSet class, i'm afraid, have the same bug. I must
explicitly add all included schemas via Add method to get it work.

What i want is automatic addition all included schemas into the schema set.
With best regards, Alex Shirshov.

Nov 12 '05 #2
Hello, Priya!
You wrote on Fri, 23 Jul 2004 15:29:25 -0700:

PLM> The problem might be related to how you add your main schema to the
PLM> XmlSchemaSet. If you add the main schema by using the overload that
PLM> takes in XmlReader and you created the XmlTextReader by passing in a
PLM> stream (and did not pass in the baseUri of the file)
PLM> then, the baseUri of the main schema would be string.Empty.
[Sorry, skipped]

I'm loading schema in another way:

Dim rd As New IO.StreamReader(pathToSchema)
Dim _schema as Schema.XmlSchema = Schema.XmlSchema.Read(rd, AddressOf
ValidationSchemaCallBack)
Dim ss as new Schema.XmlSchemaSet
ss.Add(_schema)

SourceURI of the schema is string.empty in this case.

PLM> If the schema is loaded as shown above, the baseUri of the main schema
PLM> is string.Empty as XmlTextReader accepts baseUri only when the
PLM> corresponding overload is used.
PLM> XmlTextReader reader = new XmlTextReader(mySchemaUrl, fileStream);

In other words, i have to load schema only via XmlTextReader! Great!

PLM> or add the schema to the set passing in the url directly.

What does xmlschema need for? I don't even compile it!

PLM> "Alex Shirshov" <no****@mail.ru> wrote in message
PLM> news:Oy******************@TK2MSFTNGP09.phx.gbl...
??>> Hello, All!
??>>
??>> It seems the bug
??>>
PLM> (http://groups.google.com/groups?hl=r...adm=a53b01c28a
PLM> 00%242
??>>
PLM> 08bc860%2439ef2ecf%40TKMSFTNGXA08&rnum=8&prev=/groups%3Fq%3DschemaLoca
PLM> tion%2
??>>
PLM> BXmlSchema%2B.NET%26hl%3Dru%26lr%3D%26ie%3DUTF-8%26selm%3Da53b01c28a00
PLM> %25242
??>> 08bc860%252439ef2ecf%2540TKMSFTNGXA08%26rnum%3D8) wasn't fixed neither
??>> in v1.1 nor in v2.0. Here is exception Unhandled Exception:
System.Xml.Schema.XmlSchemaException: Cannot
??>> resolve schema Location attribute. at
??>> Modile1.ValidationSchemaCallBack(Object sender, ValidationEventArgs
PLM> e)
??>> at
PLM> System.Xml.Schema.BaseProcessor.SendValidationEven t(XmlSchemaException
??>> e, XmlSeverityType severity)
??>> at
PLM> System.Xml.Schema.SchemaCollectionPreprocessor.Loa dExternals(XmlSchema
??>> schema, XmlSchemaCollection xsc)
??>> at System.Xml.Schema.SchemaCollectionPreprocessor.Exe cute(XmlSchema
??>> schema, String targetNamespace, Boolean loadExternals,
??>> XmlSchemaCollection xsc) at
??>> System.Xml.Schema.XmlSchema.CompileSchema(XmlSchem aCollection
??>> xsc, XmlResolver resolver, SchemaInfo schemaInfo, String
??>> ns, ValidationEventHandler validationEventHandler, XmlNameTable
??>> nameTable, Boolean CompileContentModel) at
??>> System.Xml.Schema.XmlSchema.Compile(ValidationEven tHandler validationE
??>> ventHandler) Moreover, new XmlSchemaSet class, i'm afraid, have the
??>> same bug. I must explicitly add all included schemas via Add method to
??>> get it work. What i want is automatic addition all included schemas
??>> into the schema
PLM> set.
??>>
??>> With best regards, Alex Shirshov.
??>>

With best regards, Alex Shirshov.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use...
1
by: Fred Smith | last post by:
Any suggestions or tips to the questions below I have been wrestling with would be most welcome: I have an example XSD file I have been experimenting with. Suppose a user can select from 1 to 4...
2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
4
by: Stefan Rotter | last post by:
Hi, I'm trying to load a schema into an XmlSchema object with the Read and Compile methods. I use Read with a ValidationEventHandler. No errors occurs but when I look at the XmlSchema properties...
3
by: Nathan Wallace | last post by:
Hello, I have 2 schema, for argument sake let's call them child.xsd and parent.xsd. I define all my types in parent.xsd and the child.xsd include the parent.xsd using the following tag: ...
1
by: Victor Hadianto | last post by:
Hi, I have a simple XSD for example like this: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified">...
1
by: qdm | last post by:
Below is a snippet that I'm sure is quite familiar to most ... <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" Here, I've given the XMLSchema namespace the prefix 'xsd', and with...
2
by: Gary McGill | last post by:
I'm finding the XmlSchema object model very hard to follow :-( I've figured out by trial and error how to do most things I need, but this one has me beat. Suppose my schema has a simple type...
1
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.