Martin,
I did reference some of those topics, but may not be to fullest extent.
I have advanced to an extent in reading the contents of schema files.
In brief, the schema files i am using are nested, in the sense, i have
the following:
-Parent.xsd [Schema directly used by the xml file]
-Child1.xsd, Child2.xsd [Both the schemas are import/included by the
Parent.xsd]
-Types1.xsd, Types2.xsd [Contains some basic types import/included by
the Childx.xsd files]
Basically, the schema is not so complicated, but i have issues
pertaining to nillable types, wherein i have to use "xsi:nil=tr ue" for
emplty nillable type elements. My approach is to parse through the
schema recursively and get the list of type declaration for
XmlSchemaElemen ts.
Then for every empty element to be written to xml file, i check the
above list for nillable type, in which case i add "xsi:nil=tr ue" to the
element.
Following is the code for obtaining list of all xmlschemaelemen ts
recursively:
-----BEGIN-----
XmlSchemaCollec tion o = new XmlSchemaCollec tion();
o.Add(sIssueTyp e,new XmlTextReader(s SchemaFile),new XmlUrlResolver( ));
_oCollecElement s = new ArrayList();
foreach(XmlSche ma ienmr in o)
{
foreach(object item in ienmr.Elements. Values)
{
_oCollecElement s.Add(item);
}
}
--------END------
The above approach lists all the xmschemaelement s from Parent.xsd,
Child1.xsd and Child2.xsd , but doesn't list the xmlschemaelemen ts in
Types1.xsd and Types2.xsd. The Types1.xsd is imported by Child1.xsd
using the following statement <xs:include schemaLocation= "Types1.xsd "
/within the Child1.xsd file. So, i am expecting the
XmlSchemaCollec tion to resolve the types in the Types1.xsd file as
well.
Does my approach make any sense to you?
TIA.
Sek
Martin Honnen wrote:
Sek wrote:
Is there any way to achieve this in 1.1?
.NET 1.x also has a SOM (Schema Object Model) but slightly different, see
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpguide/html/cpconXSDSchemaO bjectModelSOM.a sp>
for details.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/