Hi
I have a server that generates this code
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>
I want to add another item to this shopping list.
So I am trying to do something like
HTML Code:
Element element = doc.createElement("item");
doc.getDocumentElement().appendChild(element);
But this is not the way to do it.
It is generating
<item/>
& putting it here:
</products><item/></shoppingList>
What I need is to generate
HTML Code:
<product><id>4</id><name>Cakes</name><status>open</status>
& put it before
</products></shoppingList>
at the end of the list.
Does anyone know how to do that?
Thank you,
Sara