Hi,
I am using Xerces parser for Java version 131. I was trying the samples for
dom(dom.DOMCount with validation turned on). It works fine with validation
of schemas when there are no namespaces in instance xml document. When I add
the name spaces, it doesn't seem to recognize the content model. I am
enclosing the samples files. This is the error I get:
 
 java dom.DOMCount -v account.xml
 The content of element type "anu:rootElement" must match
"(InvoiceNo+,ProductID+,ProductCode+)".

 
<!--XML Schema fragment in file schema1.xsd-->
<schema xmlns:anu='anutech.com'
       xmlns:xsd='http://www.w3.org/2001/XMLSchema'
       targetNamespace='anutech.com'>
<element name="rootElement">
  <complexType> <!-- default for content is element only -->
     <sequence>
     <element ref="InvoiceNo" minOccurs='1' maxOccurs='unbounded'/>       
     <element ref="ProductID" minOccurs='1' maxOccurs='unbounded'/>
     <element ref="ProductCode" minOccurs='1' maxOccurs='unbounded'/>   
     </sequence>
  </complexType>
</element>
<element name='InvoiceNo' type='integer'/>
<element name='ProductID' type='string'/>
<element name='ProductCode' type='string' /> 
</schema>


THIS IS THE INSTANCE FILE.
<?xml version="1.0" encoding="UTF-8"?>
<anu:rootElement xmlns:anu='anutech.com'
             xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";

               xsi:schemaLocation='anutech.com account.xsd'>
<anu:InvoiceNo>123456789</anu:InvoiceNo>  
<anu:ProductID>99</anu:ProductID>     
<anu:ProductCode>A</anu:ProductCode>   
</anu:rootElement>

IT WORKS FINE IF I ADD THE NAMESPACE TO QUALIFY THE ELEMENT.
     <sequence>
      <element ref="anu:InvoiceNo" minOccurs='1' maxOccurs='unbounded'/>

      <element ref="anu:ProductID" minOccurs='1' maxOccurs='unbounded'/>
      <element ref="anu:ProductCode" minOccurs='1' maxOccurs='unbounded'/>

     </sequence>

Is it an error in the first place with the parser that it let go the first
schema? Or is it something to do with elementFormDefault attribute that the
parser seems to assume that is "qualified"?

Thanks.
-Thakur


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

Reply via email to