Hi,
Trying to start using the API. Following the instructions in the tutorial I
can get the schema to print fine.
However now I would like to start accessing elements.
I tried the following:
InputStream is = new FileInputStream("note.xsd");
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
XmlSchemaObjectTable objectTable = schema.getElements();
System.out.println(objectTable.getCount());
This prints out 0. Should it not print out the number of elements?
notes.xsd is as follows:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks,
Patrick