473,322 Members | 1,188 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,322 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 1876
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.