Hello everybody!

I still have a problem getting the 'correct' type information about
elements in an XML document by accessing the PSVI via DOM. I have the
following XML schema (taken from the W3C primer):

--------------------------------------------------------------
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

 <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
 
 <xsd:complexType name="PurchaseOrderType">
   <xsd:sequence>
     <xsd:element name="shipTo" type="USAddress"/>
     ...
   </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="USAddress">
   ...
 </xsd:complexType>
</xsd:schema> 
--------------------------------------------------------------

and this instance document:

<purchaseOrder
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xsi:noNamespaceSchemaLocation='po.xsd'>
    <shipTo country="US">
        <name>Alice Smith</name><street>123 Maple Street</street>
        <city>Mill Valley</city>
        <state>CA</state>
        <zip>90952</zip>
    </shipTo>
...
</purchaseOrder>
--------------------------------------------------------------

I use DOM and this own code to get the type information:


parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);
parser.setProperty("http://apache.org/xml/properties/dom/document-class-name";,
                   "org.apache.xerces.dom.PSVIDocumentImpl");
...
Node node;
...
if (node.getNodeType() == Node.ELEMENT_NODE)
{
 XSTypeDefinition type = ((ElementPSVI) node).getTypeDefinition();
 System.out.print(type.getName());
}
...
--------------------------------------------------------------

PROBLEM:
Now, when processing the element "shipTo" in the instance document,
Xerces returns as its type "PurchaseOrderType". But instead, from my
point of view, it should return "USAddress" as this is the element's
schema "{type definition}" (cf. W3C Schema Part I, section 3.3.5).

What am I missing or doing wrong? How do I get the desired result
"USAddress" for the "shipTo" element?

Sorry for posting this question again, but I really would appreciate
any help on this since I need the PSVI functionality to proceed on my
project.


Regards,
 Matthias                          

--
Matthias Ferdinand
Distributed and Information Systems - VSIS
Computer Science, University of Hamburg
EMail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to