XML Export - Formating and hierarchy

LS_B-SLS_B-S Member Posts: 3
First i want to say Hallo to everyone. :)

And now my question.
I want to export some parameters to a xml file. The XML MUST look like this
<?xml version="1.0" encoding="windows-1250"?>
<CAS_POLSKA>
<Komunikacja>
<Typ>TCPIP</Typ>
<Adres>10.10.1.233</Adres>
<Port>20304</Port>
<Interval>5000</Interval>
<Retry>3</Retry>
<TYPWAGI>LP</TYPWAGI>
<RODZAJWAGI>CL5000</RODZAJWAGI>
<PASEKPOSTEPU>1</PASEKPOSTEPU>
<DEBUGMESS>1</DEBUGMESS>
<AKCJA>WYSYLKA</AKCJA>
<TYPDANYCH>PLU</TYPDANYCH>

</Komunikacja>

<DEFAULT DEPARTMENT="4" PLUTYPE="1" />

<Dane>
<RECORD PLU="1" NAZWA01="Szynka Aleksandryjska" UNITPRICE="2222" ITEMCODE="50001" />
<RECORD PLU="2" NAZWA01="Salami -wino" UNITPRICE="2222" ITEMCODE="50002" />
<RECORD PLU="3" NAZWA01="Salami Spianta Romana" UNITPRICE="2222" ITEMCODE="50003" />
<RECORD PLU="4" NAZWA01="Pasztet z pieca Czyżew" UNITPRICE="2222" ITEMCODE="50004" />
<RECORD PLU="5" NAZWA01="Ogonówka Olewnik" UNITPRICE="2222" ITEMCODE="50005" />
<RECORD PLU="6" NAZWA01="Szynka czosnkowa" UNITPRICE="2222" ITEMCODE="50006" />
<RECORD PLU="7" NAZWA01="Salami Tunel" UNITPRICE="2222" ITEMCODE="50007" />
<RECORD PLU="8" NAZWA01=" Boczek wędzony parzony Sokołó" NAZWA02="w" UNITPRICE="2222" ITEMCODE="50008" />
<RECORD PLU="9" NAZWA01="Indyk pieczony" UNITPRICE="2222" ITEMCODE="50009" />
<RECORD PLU="10" NAZWA01="Kurczak faszerowany Czyżew" UNITPRICE="2222" ITEMCODE="50010" />
<RECORD PLU="11" NAZWA01="Kiełbasa dębowa" UNITPRICE="2222" ITEMCODE="50011" />
<RECORD PLU="12" NAZWA01="Kiełbasa swojska" UNITPRICE="2222" ITEMCODE="50012" />
<RECORD PLU="13" NAZWA01="Salami Milano" UNITPRICE="2222" ITEMCODE="50013" />
<RECORD PLU="14" NAZWA01="Kiełbasa polska Corrida" UNITPRICE="2222" ITEMCODE="50014" />
</Dane>

</CAS_POLSKA>

How to do this ???

I started with XMLport but the final file look like this:

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<CAS_POLSKA>
<Komunikacja>
<Typ>TCPIP</Typ>
<Adres>10.10.10.130</Adres>
<Port>20304</Port>
<Interval>5000</Interval>
<Retry>3</Retry>
<TYPWAGI>LP</TYPWAGI>
<RODZAJWAGI>CL5000</RODZAJWAGI>
<PASEKPOSTEPU>1</PASEKPOSTEPU>
<DEBUGMESS>1</DEBUGMESS>
<AKCJA>WYSYŁKA</AKCJA>
<TYPDANYCH>PLU</TYPDANYCH>
</Komunikacja>
<Dane>
<RECORD PLU="0005" NAZWA01="Salceson czarny" UNITPRICE="" ITEMCODE="0005"/>
</Dane>
<Dane>
<RECORD PLU="0008" NAZWA01="Szynka z piersi ind." UNITPRICE="" ITEMCODE="0008"/>
</Dane>
<Dane>
<RECORD PLU="0010" NAZWA01="Indyk faszerowany" UNITPRICE="" ITEMCODE="0010"/>
</Dane>
</CAS_POLSKA>

It seems OK but <Dane> and <RECORD> are wrong. It should be <Dane> then all records (<RECORD>) and on the end </Dane>

I dont know how to do this with XMLport.

Maybe someone know how can i do this with XMLDOM ?
I try it but this is my result :shock:

<CAS_POLSKA><Komunikacja><Typ></Typ><Adres></Adres><Port>0</Port><Interval>0</Interval><Retry>0</Retry><TYPWAGI></TYPWAGI>
<RODZAJWAGI></RODZAJWAGI><PASEKPOSTEPU>0</PASEKPOSTEPU>
<DEBUGMESS>0</DEBUGMESS><AKCJA></AKCJA><TYPDANYCH></TYPDANYCH></Komunikacja>
<Dane><RECORD/><PLU>0005</PLU><NAZWA01>SALCESON CZARNY</NAZWA01><UNITPRICE></UNITPRICE><ITEMCODE>0005</ITEMCODE></Dane><Dane><RECORD/><PLU>0008</PLU><NAZWA01>SZYNKA Z PIERSI IND.</NAZWA01><UNITPRICE></UNITPRICE><ITEMCODE>0008</ITEMCODE></Dane><Dane><RECORD/><PLU>0010</PLU><NAZWA01>INDYK FASZEROWANY</NAZWA01><UNITPRICE></UNITPRICE><ITEMCODE>0010</ITEMCODE></Dane></CAS_POLSKA>


So as You can see XMLport is almost Ok but not like the original and XMLDOM is a total mess.

I read that with XMLDOM you have more control and maybe even it is able to insert the correct encoding, but how to do this ??????

Thats all. If someone could help with this i would be grateful.

Thank You.


Lukasz

Answers

  • girish.joshigirish.joshi Member Posts: 407
    You can do this easily with both XMLPorts and the XMLDom.

    The XMLDom is a little more flexible.

    With XMLPorts you must create a <DANE> element above your PLU element. Make sure to indent your PLU element underneath the <DANE ELEMENT>

    If you want instruction using the DOM, take a look at the code in the followign codeunits (its pretty easy to follow)

    99008517 XML Document-Create
    99008516 BizTalk XML DOM Management

    I think the API is pretty easy to follow from there.
  • jlandeenjlandeen Member Posts: 524
    I have seen this problem in the past. It had to do with the XML Port Indenting structure and how the records were linked. It looks like you only want 1 instance of 'dane' element with many child 'Record' elements. Make sure that the records are setup and the structure is setup so that the Dane element is only output once and that the Record element has an indent 1 greater then Dane and is hooked up properly to the table so that you only hit it once in your thread of execution.
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • LS_B-SLS_B-S Member Posts: 3
    Thanks for the reply and help.

    The proper structure is this:

    <DANE> as Element and Text
    _<RECORD> as Element and Table
    __<PLU> as Attribute and Field
    __<NAZWA01> as Attribute and Field
    __<UNITPRICE> as Attribute and Field
    __<ITEMCODE> as Attribute and Field

    Now it looks like it should be.
    Earlier i have <DANE> as Table and that was the problem. :oops:

    Thanks once more.

    My Regards

    Lukasz
Sign In or Register to comment.