Read the schema into a DOM tree with JAXP, and then ask XmlSchema to digest the xs:schema node(s).
On Mon, Nov 16, 2009 at 9:29 AM, Stefano Tranquillini < stefano.tranquill...@gmail.com> wrote: > Hi all. > i'm trying to use XMLSchema (http://ws.apache.org/commons/XmlSchema/) to > parse the XSD. > If the file is an XSD all is ok, but if i had an XSD inside a wsdl i'm not > able to read and parse it, how can i do that? > i tryed to extract the part of the code in the wsdl between the > <wsdl:types></wsdl:types> and parse it. > but the parser returns this error > > org.apache.ws.commons.schema.XmlSchemaException: no protocol: > <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" > targetNamespace="http://webservice/xsd"> <xs:complexType > name="ComplexType"> <xs:sequence> > <xs:element minOccurs="0" name="anni" type="xs:int"/> > <xs:element minOccurs="0" name="nome" nillable="true" > type="xs:string"/> </xs:sequence> > </xs:complexType> </xs:schema> <xs:schema xmlns:ax22=" > http://webservice/xsd" attributeFormDefault="qualified" > elementFormDefault="qualified" targetNamespace="http://webservice"> > <xs:import namespace="http://webservice/xsd"/> <xs:element > name="hello"> <xs:complexType> > <xs:sequence> <xs:element minOccurs="0" name="name" > nillable="true" type="xs:string"/> > </xs:sequence> </xs:complexType> > </xs:element> <xs:element name="helloResponse"> > <xs:complexType> <xs:sequence> > <xs:element minOccurs="0" name="return" nillable="true" > type="xs:string"/> </xs:sequence> > </xs:complexType> </xs:element> <xs:element > name="dosmt"> <xs:complexType> > <xs:sequence> <xs:element minOccurs="0" name="ct" > nillable="true" type="ax22:ComplexType"/> > </xs:sequence> </xs:complexType> > </xs:element> <xs:element name="dosmtResponse"> > <xs:complexType> <xs:sequence> > <xs:element minOccurs="0" name="return" nillable="true" > type="xs:string"/> </xs:sequence> > </xs:complexType> </xs:element> </xs:schema> > at > > org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:372) > at > > org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:400) > at > > org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:418) > at xsd.Parser.exec(Parser.java:39) > at xsd.Parser.main(Parser.java:18) > > > i think it might be a problem of namespaces ore smt like that. > > any hint or ideas about to fix this code or about to parse the XSD in a > WSDL?? > > thanks > > -- > Stefano >