Hi
I have a server that generates this code
I want to add another item to this shopping list.HTML Code:<shoppingList> <counter>0</counter> − <meta> <id>1</id> <name>Unknown owner</name> <owner>Randomly generated list</owner> </meta> − <products> − <product> <id>1</id> <name>Bananas</name> <status>open</status> </product> − <product> <id>2</id> <name>Bread</name> <status>open</status> </product> − <product> <id>3</id> <name>Coke</name> <status>open</status> </product> </products> </shoppingList>
So I am trying to do something like
But this is not the way to do it.HTML Code:Element element = doc.createElement("item"); doc.getDocumentElement().appendChild(element);
It is generating
<item/>
& putting it here:
</products><item/></shoppingList>
What I need is to generate
& put it beforeHTML Code:<product><id>4</id><name>Cakes</name><status>open</status>
</products></shoppingList>
at the end of the list.
Does anyone know how to do that?
Thank you,
Sara


LinkBack URL
About LinkBacks
Reply With Quote