Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XmlSchemaSet vs XmlSchema - Browsing all xsds while using xsd:import

$
0
0

Hello all 

I have a parent XSD with multiple xsd:import. I am trying to import all the elements from the parent XSD using my utility and there is a difference of "schema.Elements.Count" between C# code in .NET1.1 and .NET4.0

.NET1.1 code snippet

 XmlSchema schema;

xmlReader = new XmlTextReader(sourceUri);
xmlReader.Read();
encoding = xmlReader.Encoding;
schema = XmlSchema.Read(xmlReader, validationHandler);
schema.Compile(validationHandler);

.NET4 code snippet

 XmlSchema schema;

xmlReader = new XmlTextReader(sourceUri);
xmlReader.Read();
encoding = xmlReader.Encoding;

schema = XmlSchema.Read(xmlReader, validationHandler);
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.ValidationEventHandler += new ValidationEventHandler(validationHandler);
schemaSet.Add(schema);

schemaSet.Compile()

My questions

1) I am trying to browse the schemas and display the nodes and its elements, attributes etc.

Parent xsd has 3 elements and the xsd which was imported has 1 element. In  .NET4 the "schema.Elements.Count" gives only 3 whereas the .NET1.1 gives 4 . Due to this I am unable to display all 4 nodes ( to be more clear it displays the nodes from parent xsd but not from imported xsd) in .NET4 where as I am able to display all 4 nodes in .NET1.1

I have a huge xsd which cannot be shared with 72 nodes. I can upload the simple testcase where I could reproduce the issue with my utility.

Thanks in advance

Sateesh



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>