Hi Guys,
I am building an application that extracts Types and there namespace from XSD files.
The XSD file could be complex with multiple imports and multiple namespaces declared within. Here is simple example...
<schema targetNamespace="http://www.example.com/Report" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:r="http://www.example.com/Report" xmlns:xipo="http://www.example.com/IPO" elementFormDefault="qualified"><import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/><complexType name="PartsType"><sequence><element name="part" maxOccurs="unbounded"><complexType><simpleContent><extension base="string"><attribute name="number" type="xipo:SKU"/></extension></simpleContent></complexType></element></sequence></complexType></schema>
When I load this schema into a schema cache and traverse the tree I am missing the namespace of the imported type and the prefix has been stripped from its name.
<xsd:complexType name='PartsType'><xsd:sequence><xsd:element name='part' maxOccurs='unbounded' abstract='False'id=''namespace='http://www.example.com/Report'><xsd:complexType><xsd:attribute name='number' type='SKU' namespace='' use='optional'/></xsd:complexType></xsd:element></xsd:sequence></xsd:complexType>
So originally the type was "xipo:SKU" which has now become "SKU".
The namespace should be "http://www.example.com/IPO"which is the namespace for the prefix "xipo".
Any suggestions on how to preserve the namespaces in complex XSD's like this? Is the SOM model appropriate for this application?
Any help would be much appreciated.
Daniel