To get text value, or any other object value for that matter, use
getObjectValue() function.
It will attempt to auto detect, and return to you the object of type this
node maps to.
If you do not have an "xsi:type" attribute in the element you can do 2
things.
1) Set the type of the element then get its value. WARNING: When you re
serialize this element, it will contain the type attribute. Resulting object
reference will be cached by the element (additional calls are free).
        myNode.setType(Constants.SOAP_STRING);
        String result=(String)myNode.getObjectValue();
2) Do a clean deserialization of the node to a passed type. This WILL NOT
CACHE the result. This is a bad call to do on the same node more than 1
time.
        String result=(String)myNode.getValueAsType(Constants.SOAP_STRING);

-Taras

> -----Original Message-----
> From: Glyn Normington [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: Re: MessageElement
> 
> 
> I deferred supporting nodes of type javax.xml.soap.Text as 
> they are poorly
> defined by the JAXM spec. For instance it is not clear how 
> such nodes can
> be mixed with other sibling nodes. The method below
> (javax.xml.soap.Node.getValue) is only defined in the case of a single
> child node which is of type javax.xml.soap.Text.
> 
> If I could get a clear understanding of the concept in the 
> JAXM spec., I
> would be more inclined to implement it. Currently, I don't 
> think Axis has a
> requirement for these special text and text comment nodes 
> apart from JAXM
> compliance.
> 
> Glyn
> 
> 
>                                                               
>                                                               
>          
>                       "Adam.Leggett"                          
>                                                               
>          
>                       <Adam.Leggett@upc        To:       
> "Axis User ([EMAIL PROTECTED])" 
> <[EMAIL PROTECTED]>           
>                       o.co.uk>                 cc:            
>                                                               
>          
>                                                Subject:  
> MessageElement                                                
>               
>                       10/04/02 14:50                          
>                                                               
>          
>                       Please respond to                       
>                                                               
>          
>                       axis-user                               
>                                                               
>          
>                                                               
>                                                               
>          
>                                                               
>                                                               
>          
> 
> 
> 
> I need to get the text node from a MessageElement
> 
> The xml element is: <msid xsi:type="xsd:string">111111</msid>
> 
> getValue() returns null
> 
> i.e.
> /**
>      * Text nodes are not supported.
>      */
>     public String getValue() {
>         return null;
>     }
> 
> I cetainly would like to avoid using getAsDOM() etc
> 
> Is my only option to use toString() ?
> 
> Adam Leggett
> UPCO
> Direct Line: 0113 20 10 631
> Fax: 0113 20 10 666
> <http://www.upco.co.uk>
> The contents of this email are intended for the named 
> addressees and may
> contain confidential and / or privileged material. If 
> received in error,
> please contact UPCO on +44 (0)113 20 10 600 and then delete the entire
> email
> from your system. Unauthorised review, distribution, 
> disclosure or other
> use
> of this information could constitute a breach of confidence. Your
> co-operation in this matter is greatly appreciated.
> 
> 
> 
> 
> 
> 

Reply via email to