You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jerome baumgarten <je...@yahoo.fr> on 2002/11/19 13:26:56 UTC

Text nodes returned as part of the SOAP response

Hi,

I am using Axis for some developements. I provide
through Axis a simple web service returning the local
time for a given city (ex Europe/Paris) and a Locale
(ex fr). I retrieve the result from a java piece of
code. During some testing I realized that I get two
text nodes as part of the reponse. Here is an example
of the response:

<ns1:getTimeResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="Time"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <getTimeReturn xsi:type="xsd:string"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">mardi,
19 novembre 2002 09:12:43 Heure d&apos;Europe
centrale</getTimeReturn>
  </ns1:getTimeResponse>

When getting the children nodes of the getTimeResponse
element (through the getChildNodes() method), I
actually get three nodes. The first one is a text node
containing some whitespaces and a CR. The second node
is the getTimeReturn element. And the third node is
also a text node containing, as the first one, some
withespaces and a CR. It seems to me that these two
text nodes are some kind of pretty pretting stuff.

Is that a normal behaviour of having such text nodes
in the response ? If not is it a bug or some kind of
misconfiguartion on my side.

Regards.

Jerome


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: Text nodes returned as part of the SOAP response

Posted by Alex Dovlecel <do...@kbs.twi.tudelft.nl>.
AFAIK this is the normal behaviour for each parser. BEcause it does not know 
if the text before the tag is relevant or not... so the parser just gives it 
to you. 

If you have a DTD refference at the begining of your document and turn the 
parser validation on, you will not receive the text fields anymore. But i 
suppose you can't have a DTD reference at the begining of a soap xml so... 

This is the correct behavior of xml parsers... 

If somebody knows that I am wrong just say so, because I am pretty new to the 
parsing stuff and I hit the same wall once. 

And if we start talking about parsers, I do have one question: I have an xml 
with no DTD reference. But I want to validate the xml with some DTD that I 
have. How can I do that (without changing the xml, but just calling some 
methods of the parser, like setDTD(INputStream) ). I use Xerces, if this 
helps...

Tx 
dovle

>
> I am using Axis for some developements. I provide
> through Axis a simple web service returning the local
> time for a given city (ex Europe/Paris) and a Locale
> (ex fr). I retrieve the result from a java piece of
> code. During some testing I realized that I get two
> text nodes as part of the reponse. Here is an example
> of the response:
>
> <ns1:getTimeResponse
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns1="Time"
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>    <getTimeReturn xsi:type="xsd:string"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">mardi,
> 19 novembre 2002 09:12:43 Heure d&apos;Europe
> centrale</getTimeReturn>
>   </ns1:getTimeResponse>
>
> When getting the children nodes of the getTimeResponse
> element (through the getChildNodes() method), I
> actually get three nodes. The first one is a text node
> containing some whitespaces and a CR. The second node
> is the getTimeReturn element. And the third node is
> also a text node containing, as the first one, some
> withespaces and a CR. It seems to me that these two
> text nodes are some kind of pretty pretting stuff.
>
> Is that a normal behaviour of having such text nodes
> in the response ? If not is it a bug or some kind of
> misconfiguartion on my side.
>
> Regards.
>
> Jerome
>
>
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com