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 Sunny44 <su...@yahoo.com> on 2007/06/28 20:23:11 UTC

Unable to get the top element of an XML

I have created the ADB object using ADB code generator. (PLAIN JAVA).

My unit test works in following manner 

It UnMarshall the Input XML to OBJECTS and from OBJECT to XML

But the Problem is in the result XML is 

1> It does not include the top element.
2> It contains xsi:nil in reoccurring element headers. 

Sample code 

UN-Marshall
	reader = XMLInputFactory.newInstance().createXMLStreamReader(
                new ByteArrayInputStream(this.inputXML.getBytes()));
		Object returnObj = Helper.parse(reader); - WORKS 

MARSHALLER

			XMLStreamReader reader = Helper.getPullParser(ci,
ContentItemsHelper.MY_QNAME);
			OMElement omElt =  new StAXOMBuilder(reader).getDocumentElement();
			String xml = omElt.toString();

****

xml string does not contain the header element

Sample XML
<items xmlns:p=""bla bla" xmlns:xsi="bla bla ">  ----- MISSING
 <item>
     <id>1234</id>
 <item>
</items>   ---   MISSING 

Please advice how do i get the Top ELEMENT

Thanks

Sunny



-- 
View this message in context: http://www.nabble.com/Unable-to-get-the-top-element-of-an-XML-tf3995959.html#a11348317
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Unable to get the top element of an XML

Posted by Sunny44 <su...@yahoo.com>.
Amila,

I am using Plain Java Object that doe not include any Factory. even Helper
class does not include and Factory definition that is the reason i am unable
to utilize the Factory.parse(). 

Please advice me how to get Factory on Plan Java objects

Thanks

Sunny




Amila Suriarachchi wrote:
> 
> if you give me your schema I can help you more.
> 
> instead of using the Helper use <TopElement>.Factory.parse() method to
> create the object and
> use <TopElement>.getOMElement() method to get the OM Element.
> 
> please see some ADB test classes.
> 
> Amila.
> 
> 
> On 6/28/07, Sunny44 <su...@yahoo.com> wrote:
>>
>>
>> I have created the ADB object using ADB code generator. (PLAIN JAVA).
>>
>> My unit test works in following manner
>>
>> It UnMarshall the Input XML to OBJECTS and from OBJECT to XML
>>
>> But the Problem is in the result XML is
>>
>> 1> It does not include the top element.
>> 2> It contains xsi:nil in reoccurring element headers.
>>
>> Sample code
>>
>> UN-Marshall
>>         reader = XMLInputFactory.newInstance().createXMLStreamReader(
>>                 new ByteArrayInputStream(this.inputXML.getBytes()));
>>                 Object returnObj = Helper.parse(reader); - WORKS
>>
>> MARSHALLER
>>
>>                         XMLStreamReader reader = Helper.getPullParser(ci,
>> ContentItemsHelper.MY_QNAME);
>>                         OMElement omElt =  new
>> StAXOMBuilder(reader).getDocumentElement();
>>                         String xml = omElt.toString();
>>
>> ****
>>
>> xml string does not contain the header element
>>
>> Sample XML
>> <items xmlns:p=""bla bla" xmlns:xsi="bla bla ">  ----- MISSING
>> <item>
>>      <id>1234</id>
>> <item>
>> </items>   ---   MISSING
>>
>> Please advice how do i get the Top ELEMENT
>>
>> Thanks
>>
>> Sunny
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Unable-to-get-the-top-element-of-an-XML-tf3995959.html#a11348317
>> Sent from the Axis - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 
> -- 
> Amila Suriarachchi,
> WSO2 Inc.
> 
> 

-- 
View this message in context: http://www.nabble.com/Unable-to-get-the-top-element-of-an-XML-tf3995959.html#a11365412
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Unable to get the top element of an XML

Posted by Amila Suriarachchi <am...@gmail.com>.
if you give me your schema I can help you more.

instead of using the Helper use <TopElement>.Factory.parse() method to
create the object and
use <TopElement>.getOMElement() method to get the OM Element.

please see some ADB test classes.

Amila.


On 6/28/07, Sunny44 <su...@yahoo.com> wrote:
>
>
> I have created the ADB object using ADB code generator. (PLAIN JAVA).
>
> My unit test works in following manner
>
> It UnMarshall the Input XML to OBJECTS and from OBJECT to XML
>
> But the Problem is in the result XML is
>
> 1> It does not include the top element.
> 2> It contains xsi:nil in reoccurring element headers.
>
> Sample code
>
> UN-Marshall
>         reader = XMLInputFactory.newInstance().createXMLStreamReader(
>                 new ByteArrayInputStream(this.inputXML.getBytes()));
>                 Object returnObj = Helper.parse(reader); - WORKS
>
> MARSHALLER
>
>                         XMLStreamReader reader = Helper.getPullParser(ci,
> ContentItemsHelper.MY_QNAME);
>                         OMElement omElt =  new
> StAXOMBuilder(reader).getDocumentElement();
>                         String xml = omElt.toString();
>
> ****
>
> xml string does not contain the header element
>
> Sample XML
> <items xmlns:p=""bla bla" xmlns:xsi="bla bla ">  ----- MISSING
> <item>
>      <id>1234</id>
> <item>
> </items>   ---   MISSING
>
> Please advice how do i get the Top ELEMENT
>
> Thanks
>
> Sunny
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Unable-to-get-the-top-element-of-an-XML-tf3995959.html#a11348317
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.