Expand my Community achievements bar.

List of type XML

Avatar

Level 2

For some reason this is not working for me.

I created a custom component that accepts XML types and merges them together spitting back out a type that can be read into an XML type. I need to be able to have a variable number of XML variable so I thought a list would be appropriate. I can get the LIST type INT working and STRING. But not XML. Does anyone have any clue how I can get this working and/or create a variable number of XML types on the fly?

6 Replies

Avatar

Level 6

Hi,

If I'm not wrong XML type extended from String type, so you can try to use List of String for your purpose.

At  least in Workbench if you create varible type string you can easy store there xml, and get it back.

BR,

Paul Butenko

Avatar

Level 2

The problem is that the XML type seems to keep the brackets and the XML structure in general where as the String type seems to throw it away. Either way though I cannot actually test that with a list of strings because for some silly reason i can't seem to simply assign the list the root node and have it do its thing.

Avatar

Level 8

The XML object is a representation of the org.w3c.dom.Document object.  Although LC can convert this to an string or a com.adobe.idp.Document object fairly easily, its still a w3c document under the covers.

Avatar

Level 2

So the only question that is left is how I can have a dynamic list of these guys?

Avatar

Level 6

import

com.adobe.idp.Document;

List<Document> list =

new ArrayList<Document>();

list

.add(xml);

Hope this helps.

BR

Avatar

Level 2

Thanks. I will give this a shot. I almost had things working with a map. But the problem was that the "Using XPath expressions as list indexes and map keys" help page is misleading because the funtion doesn't actually work. It will just return a null. When you put something into a string you must ommit the single quotations.