You could try using your own DocumentFactory to parse the xml schema
instance documents. e.g.

DocumentFactory factory = new DocumentFactory();
SAXReader reader = new SAXReader();
reader.setDocumentFactory( factory );
Document document = reader.parse( "foo.xml" );
List qnames = factory.getQNames();

and that should work, whether you are parsing an xml schema instance or an
xsd document.

James
----- Original Message -----
From: "Luis Pena" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 05, 2001 1:16 PM
Subject: [dom4j-dev] getQNames problem


> Hi,
>
> I don't know if I doing something wrong but I can't get the QNames of a
xsd
> document,
>
> the XSD is:
>
>
****************************************************************************
> ******************
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema";
> xmlns:my="http://www.aqs.es";>
> <xsd:simpleType name="my:tStr20">
> <xsd:restriction base="xsd:string">
> <xsd:maxLength value="20"/>
> </xsd:restriction>
> </xsd:simpleType>
> <xsd:complexType name="my:TypePeliculas">
> <xsd:sequence>
> <xsd:element name="my:Titulo" type="xsd:string"/>
> <xsd:element name="my:Link" type="xsd:uriReference"/>
> <xsd:element name="my:Anno" type="xsd:year"/>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="my:TypeBasePelicula">
> <xsd:sequence maxOccurs="0">
> <xsd:element name="my:VideoClub" type="my:tStr20"/>
> <xsd:element name="my:Peliculas" type="my:TypePeliculas" minOccurs="0"
> maxOccurs="unbounded"/>
> </xsd:sequence>
> <xsd:attribute name="my:id" value="xsd:integer"/>
> </xsd:complexType>
> <xsd:element name="my:BasePeliculas" type="my:TypeBasePelicula">
> <xsd:annotation>
> <xsd:documentation>Comprende la informacion de toda la base de
> peliculas</xsd:documentation>
> </xsd:annotation>
> </xsd:element>
> </xsd:schema>
>
****************************************************************************
> ******************
>
> And the java code is:
>
>
****************************************************************************
> ******************
>
> System.out.println("--- Inicializando SchemaManagerDataTypes ---");
> org.dom4j.io.SAXReader reader=new org.dom4j.io.SAXReader();
> File f=new File(uriSchema);
> Document doc=null;
> try {
> doc=reader.read(f);
> }catch (Exception e) {
> System.out.println(e.getMessage());
> }
>
>
>
> System.out.println("--- Cagando Schema("+uriSchema+") ---");
>
> DatatypeDocumentFactory schdf=reader.getDocumentFactory();
>
> System.out.println("-->"+schdf);
> schdf.loadSchema(doc); // Cargamos la Factory del schema
>
> _qnames=schdf.getQNames();
>
> System.out.println("-> QNames en Schema: "+_qnames.size());
> Iterator iter=_qnames.iterator();
>
> List auxL;
>
> while (iter.hasNext()) {
> QName name= (QName)iter.next();
> System.out.println("QName: "+ name.getName());
> }
>
> }
>
****************************************************************************
> ******************
> Somebody has an idea?
>
> thank you.
>
> =====================
> Luis Pena Sanchez
> A.Q.S.
> C/ Jorge Juan, 30, 6o. MADRID
>
> [EMAIL PROTECTED]
> =====================
>
>
> _______________________________________________
> dom4j-dev mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-dev
>


_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to