473,799 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 Dare (xmlschema question)

Hello, All!

It seems the bug
(http://groups.google.com/groups?hl=r...3b01c28a00%242
08bc860%2439ef2 ecf%40TKMSFTNGX A08&rnum=8&prev =/groups%3Fq%3Dsc hemaLocation%2
BXmlSchema%2B.N ET%26hl%3Dru%26 lr%3D%26ie%3DUT F-8%26selm%3Da53b 01c28a00%25242
08bc860%252439e f2ecf%2540TKMSF TNGXA08%26rnum% 3D8) wasn't fixed neither in
v1.1 nor in v2.0.

Here is exception

Unhandled Exception: System.Xml.Sche ma.XmlSchemaExc eption: Cannot resolve
schema Location attribute.
at Modile1.Validat ionSchemaCallBa ck(Object sender, ValidationEvent Args e)
at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at System.Xml.Sche ma.SchemaCollec tionPreprocesso r.LoadExternals (XmlSchema
schema, XmlSchemaCollec tion xsc)
at System.Xml.Sche ma.SchemaCollec tionPreprocesso r.Execute(XmlSc hema
schema, String targetNamespace , Boolean loadExternals, XmlSchemaCollec tion
xsc)
at System.Xml.Sche ma.XmlSchema.Co mpileSchema(Xml SchemaCollectio n xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEvent Handler validationEvent Handler, XmlNameTable nameTable,
Boolean CompileContentM odel)
at System.Xml.Sche ma.XmlSchema.Co mpile(Validatio nEventHandler
validationEvent Handler)

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 1899
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(u rl);
XmlTextReader reader = new XmlTextReader(f ileStream);
XmlSchemaSet set = new XmlSchemaSet();
set.Add(null, reader);
Console.WriteLi ne(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(m ySchemaUrl, 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******** **********@TK2M SFTNGP09.phx.gb l...
Hello, All!

It seems the bug
(http://groups.google.com/groups?hl=r...3b01c28a00%242 08bc860%2439ef2 ecf%40TKMSFTNGX A08&rnum=8&prev =/groups%3Fq%3Dsc hemaLocation%2 BXmlSchema%2B.N ET%26hl%3Dru%26 lr%3D%26ie%3DUT F-8%26selm%3Da53b 01c28a00%25242 08bc860%252439e f2ecf%2540TKMSF TNGXA08%26rnum% 3D8) wasn't fixed neither in
v1.1 nor in v2.0.

Here is exception

Unhandled Exception: System.Xml.Sche ma.XmlSchemaExc eption: Cannot resolve
schema Location attribute.
at Modile1.Validat ionSchemaCallBa ck(Object sender, ValidationEvent Args e) at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException e, XmlSeverityType severity)
at System.Xml.Sche ma.SchemaCollec tionPreprocesso r.LoadExternals (XmlSchema schema, XmlSchemaCollec tion xsc)
at System.Xml.Sche ma.SchemaCollec tionPreprocesso r.Execute(XmlSc hema
schema, String targetNamespace , Boolean loadExternals, XmlSchemaCollec tion
xsc)
at System.Xml.Sche ma.XmlSchema.Co mpileSchema(Xml SchemaCollectio n xsc,
XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEvent Handler validationEvent Handler, XmlNameTable nameTable,
Boolean CompileContentM odel)
at System.Xml.Sche ma.XmlSchema.Co mpile(Validatio nEventHandler
validationEvent Handler)

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.XmlSchem a = Schema.XmlSchem a.Read(rd, AddressOf
ValidationSchem aCallBack)
Dim ss as new Schema.XmlSchem aSet
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(m ySchemaUrl, 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******** **********@TK2M SFTNGP09.phx.gb l...
??>> Hello, All!
??>>
??>> It seems the bug
??>>
PLM> (http://groups.google.com/groups?hl=r...adm=a53b01c28a
PLM> 00%242
??>>
PLM> 08bc860%2439ef2 ecf%40TKMSFTNGX A08&rnum=8&prev =/groups%3Fq%3Dsc hemaLoca
PLM> tion%2
??>>
PLM> BXmlSchema%2B.N ET%26hl%3Dru%26 lr%3D%26ie%3DUT F-8%26selm%3Da53b 01c28a00
PLM> %25242
??>> 08bc860%252439e f2ecf%2540TKMSF TNGXA08%26rnum% 3D8) wasn't fixed neither
??>> in v1.1 nor in v2.0. Here is exception Unhandled Exception:
System.Xml.Sche ma.XmlSchemaExc eption: Cannot
??>> resolve schema Location attribute. at
??>> Modile1.Validat ionSchemaCallBa ck(Object sender, ValidationEvent Args
PLM> e)
??>> at
PLM> System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
??>> e, XmlSeverityType severity)
??>> at
PLM> System.Xml.Sche ma.SchemaCollec tionPreprocesso r.LoadExternals (XmlSchema
??>> schema, XmlSchemaCollec tion xsc)
??>> at System.Xml.Sche ma.SchemaCollec tionPreprocesso r.Execute(XmlSc hema
??>> schema, String targetNamespace , Boolean loadExternals,
??>> XmlSchemaCollec tion xsc) at
??>> System.Xml.Sche ma.XmlSchema.Co mpileSchema(Xml SchemaCollectio n
??>> xsc, XmlResolver resolver, SchemaInfo schemaInfo, String
??>> ns, ValidationEvent Handler validationEvent Handler, XmlNameTable
??>> nameTable, Boolean CompileContentM odel) at
??>> System.Xml.Sche ma.XmlSchema.Co mpile(Validatio nEventHandler 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
1776
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 of XML Schema.
1
2999
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 checkboxes on a web form: Select your favorite sport(s): (checkbox) baseball (checkbox) football
2
9093
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 other declaration. An error occurred at , (11, 3). Schema compile error: System.Exception: Schema error ---> System.Xml.Schema.XmlSchemaException: May no
4
7122
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 it contains NOTHING. The schema file is correct because I can use it to validate xmldocuments with the XMLValidatingReader. What am I doing wrong here? Code:
3
2806
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: <xs:include schemaLocation="http://localhost/xsds/parent.xsd"/> Now when I create an XmlSchema object on the child.xsd I couldn't get the type that I define in the parent.xsd. How do I get this? Do I need to create
1
1879
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"> <xs:element name="customer"> <xs:complexType mixed="false"> <xs:sequence>
1
1399
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 that, I can reference datatypes within the XMLSchema namespace ... i.e., xsd:string. That's great, but why can't I use that same notation, to reference dataypes in a homegrown schema ... WITHOUT doing an <import> or
2
1660
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 defined as follows: <xs:simpleType name="abc"> <xs:restriction base="xs:string"> <xs:enumeration value="A" />
1
4030
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 XmlSchema.Write() is changing <xsd:element minOccurs="1" name="AccountId" type="s-xsd:primarykey" /> to be
0
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.