upxml / dataport

Hi, If we use dataport with linked dataitems we have to save it to UPXML format. First stupid question, wich extension is needed (.xml don’t seems to work). I know I could make a report to do this, but It would be great if someone could share some experience with that. Thanks John

Hello John, .xml for the extension is fine (and works fine). Did you tried to open the created file with an editor (e.g. notepad) instead of an internet browser? However, if you have nested dataitems in your dataport you have to use upxml format. The resulting file is in xml-version 1.0. You cannot import this file with the same dataport. To import use a report or a codeunit. Here is some sample code: CREATE(xmldoc); xmldoc.async := FALSE; IF NOT(xmldoc.load(‘C:\path…\FoodMartData\product.xml’)) THEN ERROR(‘help’); XMLNodelist := xmldoc.getElementsByTagName(‘product’); FOR Counter := 0 TO XMLNodelist.length-1 DO BEGIN xmlnode:=XMLNodelist.item(Counter); XMLNodeChildlist:=xmlnode.childNodes; xmltable.Class := XMLNodeChildlist.item(0).text; xmltable.“No.” := XMLNodeChildlist.item(1).text; xmltable.“Description 2” := COPYSTR(XMLNodeChildlist.item(2).text,1,30); xmltable.Description := COPYSTR(XMLNodeChildlist.item(3).text,1,30); xmltable.“No. 2” := XMLNodeChildlist.item(4).text; EVALUATE(xmltable.“Unit Price”,XMLNodeChildlist.item(5).text); EVALUATE(xmltable.“Gross Weight”,XMLNodeChildlist.item(6).text); EVALUATE(xmltable.“Net Weight”,XMLNodeChildlist.item(7).text); IF NOT(xmltable.INSERT) THEN ; END; CLEAR(xmldoc); MESSAGE(‘Ready.’); where variablls are: Name DataType Subtype Length xmldoc Automation ‘Microsoft XML, v3.0’.DOMDocument30 XMLNodelist Automation ‘Microsoft XML, v3.0’.IXMLDOMNodeList xmlnode Automation ‘Microsoft XML, v3.0’.IXMLDOMElement XMLNodeChildlist Automation ‘Microsoft XML, v3.0’.IXMLDOMNodeList xmltable Record Item Counter Decimal product.xml looks like: <?xml version="1.0" encoding="UTF-8" ?> - - <product_class_id>30</product_class_id> <product_id>1</product_id> <brand_name>Washington</brand_name> <product_name>Washington Berry Juice</product_name> 90748583674 2.85 <gross_weight>8.39</gross_weight> <net_weight>6.39</net_weight> <recyclable_package>0</recyclable_package> <low_fat>0</low_fat> <units_per_case>30</units_per_case> <cases_per_pallet>14</cases_per_pallet> <shelf_width>16.9</shelf_width> <shelf_height>12.6</shelf_height> <shelf_depth>7.4</shelf_depth> But there are other solutions out here; search the forum.