Re: use of XSD



Jurjen de Groot wrote:

The type JaNeeType is defined as
<xsd:simpleType name="YesNoType">

<xsd:restriction base="xsd:string">

<xsd:enumeration value="Y Yes" />

<xsd:enumeration value="N No" />

</xsd:restriction>


Is it possible to read the XSD into some kind of xml object and access the simpleType enumerations to extract the code AND description

..NET 1.x has a schema object model (SOM) implementation with XmlSchemaCollection
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaCollectionClassTopic.asp>
and XmlSchema
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlSchemaXmlSchemaClassTopic.asp>
so you can indeed load a schema and then have an object model you can navigate. But with the complexity of possible schema structures the general navigation is also rather complex. Enumeration is just one possible facet.
See
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxsdschemaobjectmodelsom.asp>
for details about the SOM.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.



Relevant Pages

  • Re: getting around SOM limitations
    ... the SOM just won't allow me to markup a schema with custom namespace attributes. ... You can imagine what a pain it would be to have to compile and write to a memorystream everytime I want to access the value stored in the schema element declaration with DOM, not to mention trying to find the correspoding element that I was referring to with the SOM ... ...
    (microsoft.public.dotnet.xml)
  • Re: XmlSchemaElement.SchemaType returns null - bug?
    ... However, MSDN class library is poor documentation for using SOM, is there some good source of information on working with SOM? ... You must compile your schema using XmlSchema.Compile and then access the ElementType property to obtain an instance of the XmlSchemaType corresponding to the type in the schema. ... Is it correct behaviour? ...
    (microsoft.public.dotnet.xml)
  • Re: XmlSchemaElement.SchemaType returns null - bug?
    ... However, MSDN class library is poor documentation for using SOM, is there some good source of information on working with SOM? ... You must compile your schema using XmlSchema.Compile and then access the ElementType property to obtain an instance of the XmlSchemaType corresponding to the type in the schema. ... Is it correct behaviour? ...
    (microsoft.public.dotnet.general)
  • Re: XmlSchemaElement.SchemaType returns null - bug?
    ... However, MSDN class library is poor documentation for using SOM, is there some good source of information on working with SOM? ... You must compile your schema using XmlSchema.Compile and then access the ElementType property to obtain an instance of the XmlSchemaType corresponding to the type in the schema. ... Is it correct behaviour? ...
    (microsoft.public.dotnet.languages.csharp)
  • Serializing unknown objects
    ... So I created a couple of objects and serializing it into XML based upon the ... schema works perfectly. ... write the object model once, ... 'WeirdElement' class and inherit my other objects. ...
    (microsoft.public.dotnet.xml)