Hello,
I have what I think is a very simple question with regards to the Xerces 2 
Schema API. I need to parse an XML 1.0 schema that has embedded in it 
attributes from another namespace. See valid schema below. You can see the 
namespace for instance documents is "my". But, I have also defined a "yours" 
namespace and is used to further annotate the two elements "my:LineItemName" 
and "my:LineItemNumber" with labels for each. You see how I have added the 
yours:label attributes? When I parse this schema in Xerces 2, how can I get to 
these "extra" attributes? It looks to me like Xerces 2 simply ingores any 
attributes/elements that are not in the target or in the "xs" namespace. Is 
this true? If so, what other options do I have?
Thanks in advance!

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:my="my-own-namespace" targetNamespace="my-own-namespace" 
xmlns:yours="your-namespace" elementFormDefault="qualified">
    <xs:element name="LineItemList" type="my:LineItemListType"/>    
    <xs:complexType name="LineItemListType">
        <xs:sequence>
            <xs:element name="LineItem" type="my:LineItemType" 
maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="LineItemType">
        <xs:sequence>
            <xs:element name="LineItemName" type="xs:string" yours:label="Name 
Label"/>        
            <xs:element name="LineItemNumber" yours:label="Number Label" 
type="xs:string"/>
            </xs:sequence>
    </xs:complexType>
</xs:schema>

(A valid instance document for this is:

<?xml version="1.0" encoding="UTF-8"?>
<my:LineItemList xmlns:my="my-own-namespace">
    <my:LineItem>
        <my:LineItemName>XYZ Phone system</my:LineItemName>
        <my:LineItemNumber>A12345</my:LineItemNumber>
    </my:LineItem>
</my:LineItemList>
)

Reply via email to