Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<ID>1</ID>
<name>product 1</name>
<attribute id="color">red</attribute>
<attribute id="size">S</attribute>
</product>
<product>
<ID>2</ID>
<name>product 2</name>
<attribute id="color">green</attribute>
<attribute id="size">M</attribute>
</product>
<product>
<ID>3</ID>
<name>product 3</name>
<attribute id="color">blue</attribute>
<attribute id="size">L</attribute>
</product>
</products>
|=-+-----+---=|
|ID|color|size|
|=-+-----+---=|
|1 |red |S |
|2 |green|M |
|3 |blue |L |
'--+-----+----'
|=-+-----+---=|
|ID|color|size|
|=-+-----+---=|
|1 |null |null|
|2 |null |null|
|3 |null |null|
'--+-----+----'
// pseudo code patch, should be moved to proper classes:
org.talend.xml.sax.SAXLooper looper_tFileInputXML_1 = new org.talend.xml.sax.SAXLooper("/my/loop/element", new String, new boolean[]{true} );
...
java.util.Iterator<java.util.Map<String, String>> it_tFileInputXML_1 = looper_tFileInputXML_1.iterator();
while (it_tFileInputXML_1.hasNext()) {
...
row1 = new row1Struct();
try {
String nodeXML = row_tFileInputXML_1.get(".");
Document nodeDOM = org.dom4j.DocumentHelper.parseText(nodeXML);
for (String path in queryPaths_tFileInputXML_1) {
String value = nodeDOM.selectSingleNode(path);
row1.put(path, value);
}
...