As I told you before, read the entire WSDL into a single DOM document with DocumentBuilder, and then pass the schema nodes into XMLSchema. It has an API for this very purpose.
On Thu, Nov 19, 2009 at 8:47 AM, Stefano Tranquillini < stefano.tranquill...@gmail.com> wrote: > i found a problem, i've a service generated by Axis2 that gives this wsdl > (i put only the types part). > > <wsdl:types> > <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> > </wsdl:types> > > here, there are 2 schema, how can i parse this? i had to parse the second > one using the information in the first one, but how? > > On Tue, Nov 17, 2009 at 09:15, Stefano Tranquillini < > stefano.tranquill...@gmail.com> wrote: > > > I solved taking the string between the <wsdl:types></wsdl:types>, but > > adding all the namespaces of the wsdl > > now the XMLSchema parse all. > > > > > > > > On Mon, Nov 16, 2009 at 20:14, Benson Margulies <bimargul...@gmail.com > >wrote: > > > >> 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 > >> > > >> > > > > > > > > -- > > Stefano > > > > > > -- > Stefano >