Hi, 
I have written a Schema that contains couple of elements and an attribute.
When I validate it using one the samples(dom.DOMCount with -v option) it
gives me this error.

    java dom.DOMCount -v account.xml
   [Error] account.xml:7:51: The content of element type "anu:ProductID"
must match "EMPTY".
   account.xml: 1362 ms (4 elems, 4 attrs, 11 spaces, 12 chars)

  I guess the parser seems to assume that the content type as empty for
ProductID(one of the elements) when it should be elementOnly which is the
default. I am enclosing the xml instance file and the schema. Any pointers
would be appreciated.

<!--XML Schema fragment in file schema1.xsd-->
<schema targetNamespace='anutech.com'
        xmlns:xsd='http://www.w3.org/2000/10/XMLSchema'
        xmlns:anu='anutech.com'>
<element name="rootElement">
  <complexType> <!-- default for content is element only -->
     <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>
  </complexType>
</element>

<!-- Global declarations -->
<element name='InvoiceNo' type='xsd:integer'/>  
<element name='ProductCode' type='xsd:string' /> 
<element name='ProductID'>
<complexType base='xsd:string' derivedBy='extension' content='elementOnly'>
 <attribute name='type' type='xsd:string' use='required'/>
</complexType> 
</element>
</schema>

<!-- 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 type='sometype'>99</anu:ProductID>
 
<anu:ProductCode>A</anu:ProductCode>  

</anu:rootElement>


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

Reply via email to