Hi,

How can I load include the embedded xml schemas from the resource?
The catch here is that one schema is including the other schema, which fails
todo so...

I have also tried to use a custom XmlResolver but that class is never
called.

Here is my code:

  StringReader sr = new StringReader( message);
  XmlReader xr = new XmlTextReader( sr);
  XmlValidatingReader vr = new XmlValidatingReader(xr);

  XmlTextReader xsd = new XmlTextReader(
Assembly.GetExecutingAssembly().GetManifestResourceStream("myxsd"));

  vr.Schemas.Add( "", xsd); // <-- here it fails, stating it doesnt know
'VersionType'

  XmlSerializer ser = new XmlSerializer( typeof( MyObject));
  MyObject myObject = (MyObject) ser.Deserialize( vr);


Here are the xsd i am loading from the resource.

<?xml version="1.0" ?>
<xs:schema elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:include schemaLocation="CommonTypes.xsd" />
<!-- CommonTypes.xsd is also located with in the resource -->
<xs:element name="MyObject">
<xs:complexType>
<xs:sequence>
<xs:element name="Control" type="ControlType" />
</xs:sequence>
<xs:attribute name="VersionID" type="VersionType" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>

Thanks in advance,
// Ryan

-------------------------------------
The information included in this message is personal and/or confidential and
intended exclusively for the addressees as stated. This message and/or the
accompanying documents may contain confidential information and should be
handled accordingly. If you are not the intended reader of this message, we
urgently request that you notify Centric immediately and that you delete
this e-mail and any copies of it from your system and destroy any printouts
immediately.
It is forbidden to distribute, reproduce, use or disclose the information in
this e-mail to third parties without obtaining prior permission from
Centric. We expressly point out that there are risks associated with the use
of e-mail. Centric and the companies within the group shall not accept any
liability whatsoever for damage resulting from the use of e-mail. Legally
binding obligations can only arise for Centric by means of a written
instrument, signed by an authorized representative of Centric.
-------------------------------------

Reply via email to