I assumes that's: XmlSchemaObjectTable elementsObjTbl = schema.getElements(); System.out.println(elementsObjTbl.getCount());
That's also empty. On Fri, Apr 10, 2009 at 9:27 PM, Benson Margulies <[email protected]>wrote: > I would expect that code of yours to work. My only suggestion before I > debug is that you get the element collection and see if THAT is also > empty. > > > On Fri, Apr 10, 2009 at 2:50 PM, Patrick Kiernan <[email protected]> > wrote: > > Cool, thanks :) > > Is it a bug or? > > > > Maybe you could include some code showing the common uses of the API. > > > > I basically want to be able to extract the elements of a schema and then > > display it using a > > JTree. > > > > Patrick > > > > On Fri, Apr 10, 2009 at 7:24 PM, Benson Margulies <[email protected] > >wrote: > > > >> I'm a bit buried under Passover, but I'll sort this out over the > >> weekend some time. > >> > >> On Fri, Apr 10, 2009 at 11:46 AM, Patrick Kiernan <[email protected]> > >> wrote: > >> > Version 1.4.4 > >> > > >> > On Fri, Apr 10, 2009 at 1:55 PM, Benson Margulies < > [email protected] > >> >wrote: > >> > > >> >> You don't have a target namespace.... but that should be OK. What > >> >> version have you grabbed? > >> >> > >> >> On Fri, Apr 10, 2009 at 8:11 AM, Patrick Kiernan <[email protected] > > > >> >> wrote: > >> >> > 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 > >> >> > > >> >> > >> > > >> > > >
