473,396 Members | 1,921 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,396 software developers and data experts.

XmlValidatingReader and xs:import support

Hi all. I have an XML schema that has a couple of <xs:import> tags that
reference (using schemaLocation) schemas as embedded resources in a DLL. For
example:

<xs:import namespace=http://www.my.com/my.xsd
schemaLocation="res://assembly/?MyAssembly,MyAssembly.my.xsd"/>

I've attached a derived XmlResolver class called XmlResourceResolver to the
XmlTextReader that is reading this schema. I've loaded the schema itself
from an embedded resource just fine using the custom resolver. The problem
is it appears as though the resolver is not being called to resolve the
<xs:import> element. This is, of course, leading to a whole mess of "element
not declared" errors later on in the schema.

I read a post over at .NET 247 where a Microsoft support rep stated that a
problem appearing to be the same as this one is indeed a bug with .NET 1.1.
I was wondering if anyone else had either gotten this to successfully work
or is aware of exactly what the bug is.

Thanks,

Nate
Nov 12 '05 #1
3 1722
Did you attach the resolver to the reader or schema collection?

"Nathan Alden" <a@a.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
Hi all. I have an XML schema that has a couple of <xs:import> tags that
reference (using schemaLocation) schemas as embedded resources in a DLL. For example:

<xs:import namespace=http://www.my.com/my.xsd
schemaLocation="res://assembly/?MyAssembly,MyAssembly.my.xsd"/>

I've attached a derived XmlResolver class called XmlResourceResolver to the XmlTextReader that is reading this schema. I've loaded the schema itself
from an embedded resource just fine using the custom resolver. The problem
is it appears as though the resolver is not being called to resolve the
<xs:import> element. This is, of course, leading to a whole mess of "element not declared" errors later on in the schema.

I read a post over at .NET 247 where a Microsoft support rep stated that a
problem appearing to be the same as this one is indeed a bug with .NET 1.1. I was wondering if anyone else had either gotten this to successfully work
or is aware of exactly what the bug is.

Thanks,

Nate

Nov 12 '05 #2
As I stated in my post, I attached the resolver to the XmlTextReader object
I used to read the schema.

"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
Did you attach the resolver to the reader or schema collection?

"Nathan Alden" <a@a.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
Hi all. I have an XML schema that has a couple of <xs:import> tags that
reference (using schemaLocation) schemas as embedded resources in a DLL.

For
example:

<xs:import namespace=http://www.my.com/my.xsd
schemaLocation="res://assembly/?MyAssembly,MyAssembly.my.xsd"/>

I've attached a derived XmlResolver class called XmlResourceResolver to

the
XmlTextReader that is reading this schema. I've loaded the schema itself
from an embedded resource just fine using the custom resolver. The
problem
is it appears as though the resolver is not being called to resolve the
<xs:import> element. This is, of course, leading to a whole mess of

"element
not declared" errors later on in the schema.

I read a post over at .NET 247 where a Microsoft support rep stated that
a
problem appearing to be the same as this one is indeed a bug with .NET

1.1.
I was wondering if anyone else had either gotten this to successfully
work
or is aware of exactly what the bug is.

Thanks,

Nate


Nov 12 '05 #3
You need to pass the resolver to the Compile method of XmlSchema. Attaching
a resolve to the XmlTextReader will not work since reading in the schema
does not resolve imports.

Zafar

"Nathan Alden" <vi***************@hotmail.com> wrote in message
news:ed*************@TK2MSFTNGP10.phx.gbl...
As I stated in my post, I attached the resolver to the XmlTextReader object I used to read the schema.

"Zafar Abbas" <so*****@somewhere.com> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
Did you attach the resolver to the reader or schema collection?

"Nathan Alden" <a@a.com> wrote in message
news:OK**************@TK2MSFTNGP14.phx.gbl...
Hi all. I have an XML schema that has a couple of <xs:import> tags that
reference (using schemaLocation) schemas as embedded resources in a DLL.
For
example:

<xs:import namespace=http://www.my.com/my.xsd
schemaLocation="res://assembly/?MyAssembly,MyAssembly.my.xsd"/>

I've attached a derived XmlResolver class called XmlResourceResolver to

the
XmlTextReader that is reading this schema. I've loaded the schema

itself from an embedded resource just fine using the custom resolver. The
problem
is it appears as though the resolver is not being called to resolve the
<xs:import> element. This is, of course, leading to a whole mess of

"element
not declared" errors later on in the schema.

I read a post over at .NET 247 where a Microsoft support rep stated that a
problem appearing to be the same as this one is indeed a bug with .NET

1.1.
I was wondering if anyone else had either gotten this to successfully
work
or is aware of exactly what the bug is.

Thanks,

Nate



Nov 12 '05 #4

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

Similar topics

3
by: Mark | last post by:
Hi I am encoutering a problem during the validation of an XML document when using 'XmlValidingReader'. My setup is as follows. I have a schema 'Document.xsd' which is imported into a...
1
by: Mark Collins | last post by:
Hi I am encoutering a problem during the validation of an XML document when using 'XmlValidingReader'. My setup is as follows. I have a schema 'Document.xsd' which is imported into a...
2
by: Ed Bacon | last post by:
I am a bit puzzled about the differences between XmlTextReader and XmlValidatingReader. I have been able to successfully load a DataSet object from and XML file via the text reader. However,...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
0
by: Rupa | last post by:
Hi, Can anyone tell me how to eliminate the import tags from an XSD? I want to be able to take this XSD into a Dataset using the ReadXMLSchema method of a XMLDataDocument. Currently this fails...
2
by: randar | last post by:
I'm having problems getting an XML document to validate against a fairly complex scenario. Goals: -To have two schemas with two different namespaces, so that I can validate each one seperately...
3
by: sachinvyas | last post by:
Hi, I have following schema saved in new.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://www.smpte-ra.org/schemas/429.7/2006/CPL"...
1
by: Julia | last post by:
Hi I have got two xsd files. One xsd imports the second file using the <xs:import tag. I have now put both files in the App_Code directory (is that ok). When I debug I got an error saying...
4
by: IsValidUN | last post by:
I have an XSD which has an import to an XSD located on the web which has a DTD within it. (Using VS-2005 2.0 framework) If I load the XSD using the following, it can't find elements defined within...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
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.