You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Tom Condon <to...@vrtx.com> on 2003/10/20 20:27:46 UTC

Strange problem.....

I am parsing an XML string that contains three elements.  The String  
parses fine with no errors, but when i try to access an element that I  
know to be non-null, it always returns null.

the code

SocketMessage sm = SocketMessage.Factory.parse(theMessage);

String theType = sm.getType();

// no exceptions, but theType is null


where the message is:

<hv:msg   xmlns:xs="http://www.w3.org/2001/XMLSchema"       
xmlns:hv="http://www.mycompany.com/myapp/xml"  
 ><hv:type>PEN_LOADED</hv:type><hv:body></hv:body><hv:annotation></hv: 
annotation></hv:msg>

Any ideas?

Thanks,

Tom Condon


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Strange problem.....

Posted by David Bau <da...@bea.com>.
The validator may give you more specific clues

List errors = new ArrayList();
sm.validate(new XmlOptions().setErrorListener(errors));
for (Iterator i = errors.iterator(); i.hasNext(); ) {
System.out.println(i.next()); }

Namespaces is where I usually look first. E.g., check your schemas to make
sure you're saying elementFormDefault="qualified"..

David

----- Original Message ----- 
From: "Tom Condon" <to...@vrtx.com>
To: <xm...@xml.apache.org>
Sent: Monday, October 20, 2003 2:27 PM
Subject: [xmlbeans-dev] Strange problem.....


> I am parsing an XML string that contains three elements.  The String
> parses fine with no errors, but when i try to access an element that I
> know to be non-null, it always returns null.
>
> the code
>
> SocketMessage sm = SocketMessage.Factory.parse(theMessage);
>
> String theType = sm.getType();
>
> // no exceptions, but theType is null
>
>
> where the message is:
>
> <hv:msg   xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:hv="http://www.mycompany.com/myapp/xml"
>  ><hv:type>PEN_LOADED</hv:type><hv:body></hv:body><hv:annotation></hv:
> annotation></hv:msg>
>
> Any ideas?
>
> Thanks,
>
> Tom Condon
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: Strange problem.....

Posted by David Bau <da...@bea.com>.
The validator may give you more specific clues

List errors = new ArrayList();
sm.validate(new XmlOptions().setErrorListener(errors));
for (Iterator i = errors.iterator(); i.hasNext(); ) {
System.out.println(i.next()); }

Namespaces is where I usually look first. E.g., check your schemas to make
sure you're saying elementFormDefault="qualified"..

David

----- Original Message ----- 
From: "Tom Condon" <to...@vrtx.com>
To: <xm...@xml.apache.org>
Sent: Monday, October 20, 2003 2:27 PM
Subject: [xmlbeans-dev] Strange problem.....


> I am parsing an XML string that contains three elements.  The String
> parses fine with no errors, but when i try to access an element that I
> know to be non-null, it always returns null.
>
> the code
>
> SocketMessage sm = SocketMessage.Factory.parse(theMessage);
>
> String theType = sm.getType();
>
> // no exceptions, but theType is null
>
>
> where the message is:
>
> <hv:msg   xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:hv="http://www.mycompany.com/myapp/xml"
>  ><hv:type>PEN_LOADED</hv:type><hv:body></hv:body><hv:annotation></hv:
> annotation></hv:msg>
>
> Any ideas?
>
> Thanks,
>
> Tom Condon
>
>
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/