Re: Parsing SOAP messages using kXML

Gaurav Rana <[email protected]> Fri, 18 Apr 2003 17:19:53 -0700 (PDT)
Newsgroups gmane.comp.java.enhydra.kxml
Message-ID <[email protected]>
I did try out what you said but it still does not work
and gives me the following error onthe first line
itself:

org.kxml.io.ParseException: unexpected: StartTag
<SOAP-ENV> line: -1 attr: null @-1:-1

Stack trace:
   java/lang/Throwable.<init>()V
   java/lang/Throwable.<init>(Ljava/lang/String;)V
   
My SOAP-ENV tag is:
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas/xmlsoap.org/soap/envelope/"
>

My code that "tries" to parse it is:

public static String[] xmlParse(InputStream input)
throws IOException {
XmlParser parser = new XmlParser (new
InputStreamReader(input));
parser.skip();
String SOAP_ENV=
"http://schemas/xmlsoap.org/soap/envelope/";
parser.read(Xml.START_TAG, SOAP_ENV,"Envelope" );
.....
.....
.....
..
}


Please help me out. I am new to kXML.

thanks
Gaurav
--- Stefan Haustein <[email protected]>
wrote:
> > Now I am trying to parse it using the kXML APIs.
> It seems that when you 
> > parse using kXML it accepts XML elements with only
> one word. that is it 
> > will parse <SOAP-ENV> but not <SOAP-ENV: Envelope>
> 
> (...)
> 
>  > parser.read(Xml.START_TAG, "","SOAP-ENV:Envelope
> 
> Hi,
> 
> parser.read expects the type, the namespace and the
> tag name (null for
> any). You may need to switch on namespace support.
> Please try
> 
>    String SOAP_ENV =          
> "http://schemas/xmlsoap.org/soap/envelope/";
>    parser.read(Xml.START_TAG, SOAP_ENV, "Envelope");
> 
> you may want to take a look at the ksoap Envelope
> implementation which 
> performs similar parsing steps.
> 
> > if(name.equals("PatientName xmlns=\"\"
> xsi:type=\"xsd:string\"")){
> 
> This will not work: the xml element name is only
> "PatientName", please 
> use the attribute access methods to access the
> attributes (xsi:type).
> 
> Best,
> Stefan
> 
> _______________________________________________
> Kxml mailing list
> [email protected]
> http://www.enhydra.org/mailman/listinfo.cgi/kxml