It doesn't matter if you create two, or two thousand, elements which have the same name. That's a perfectly normal thing to do. Try this slight modification of your existing code:
Joined: Dec 27, 2011
Paul Clapham wrote:It doesn't matter if you create two, or two thousand, elements which have the same name. That's a perfectly normal thing to do. Try this slight modification of your existing code:
It does matter becaue I am createing this in some java class and I MUST have same name for the elementse ITEM,VALUE AND CHARACTERSTIC!!! I simply must have two elements of ITEM,VALUE,CHARATCERSTIC but with different values for VALUE AND CHARACTERISTIC.
I think only solution is to put it in some array right? Do you please know solution? I can not create element attribute1again.
Ah, now perhaps I understand. I thought your problem was how to create the Element objects. Which of course is not a problem at all, as my example shows. But it seems that your problem is actually that you need to design a data structure to store your data in before you produce your XML.
Or do I still not understand?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to create "two dimensional" XML structure (with repeated elements )using JDOM?