Welcome! Log In Create A New Profile

Advanced

XML File

Posted by Milton 
Milton
XML File
March 20, 2009 05:52AM
Hi All,

I have a need to create an XML file, in a specified format, from a query I have constructed. I am currently printing the data to a report but I need to put in a particular XML format something like this -

Part1 - Customer data
Part2 - Product Code
Part3 - Looping through a table with sub-elements of the product and inserting drilling parameters to be sent to a CNC machine. Example is below.

Thanks,

Milton

<Order>
<CustomerCode>AUSTGEEB</CustomerCode>
<CustomerOrderID>F13456HE4</CustomerOrderID>
<!-- Customer Order ID Must be unique-->
<InvoiceAddress>
<Address>ACCOUNTS PAYABLE</Address>
<Address2>1 MyRoad</Address2>
<Address3></Address3>
<City>MyCity</City>
<PostCode>4034</PostCode>
<State>MyState</State>
<Country>Australia</Country>
</InvoiceAddress>
<OrderNotes>
<OrderNote></OrderNote>
<OrderNote></OrderNote>
</OrderNotes>
<DeliverySchedule>
<DeliveryScheduleNumber>1</DeliveryScheduleNumber>
<DateRequested>2009-03-02</DateRequested>
<DeliveryAddress>
<Address>Rear Loading Dock</Address>
<Address2>MyAddress</Address2>
<Address3></Address3>
<City>MyCity</City>
<PostCode>4034</PostCode>
<State>MyState</State>
<Country>Australia</Country>
</DeliveryAddress>
<DeliveryScheduleNotes>
<DeliveryScheduleNote>This is a Delivery Schedule Note</DeliveryScheduleNote>
</DeliveryScheduleNotes>
<OrderLine>
<LineNumber>1</LineNumber>
<ProductCode>MELDOOR</ProductCode>
<!-- Melamine Door -->
<Quantity>1</Quantity>
<Configuration>
<ConfigurationDetail>
<PanelAttributes>
<Height>720</Height>
<Width>305</Width>
<BoardColour>Indigo Haze</BoardColour>
<EdgeSection>
<Top>
<EdgeType>2mm</EdgeType>
<EdgeColour>Indigo Haze</EdgeColour>
</Top>
<Bottom>
<EdgeType>2mm</EdgeType>
<EdgeColour>Indigo Haze</EdgeColour>
</Bottom>
<Left>
<EdgeType>2mm</EdgeType>
<EdgeColour>Indigo Haze</EdgeColour>
</Left>
<Right>
<EdgeType>2mm</EdgeType>
<EdgeColour>Indigo Haze</EdgeColour>
</Right>
<Inner/>
</EdgeSection>
<Hingeholing/>
<Drilling>
<!-- Offsets are from bottom left in mm-->
<Hole>
<HoleWidth>8.0</HoleWidth>
<XHoleOffset>37</XHoleOffset>
<YHoleOffset>8.5</YHoleOffset>
<HoleDepth>16</HoleDepth>
</Hole>
<Hole>
<HoleWidth>8.0</HoleWidth>
<HoleDepth>16</HoleDepth>
<XHoleOffset>261</XHoleOffset>
<YHoleOffset>8.5</YHoleOffset>
</Hole>
<Hole>
<HoleWidth>8.0</HoleWidth>
<HoleDepth>16</HoleDepth>
<XHoleOffset>296.5</XHoleOffset>
<YHoleOffset>52</YHoleOffset>
</Hole>
<Hole>
<HoleWidth>8.0</HoleWidth>
<HoleDepth>16</HoleDepth>
<XHoleOffset>296.5</XHoleOffset>
<YHoleOffset>668</YHoleOffset>
</Hole>
<Hole>
<HoleWidth>8.0</HoleWidth>
<HoleDepth>16</HoleDepth>
<XHoleOffset>37</XHoleOffset>
<YHoleOffset>711.5</YHoleOffset>
</Hole>
<Hole>
<HoleWidth>8.0</HoleWidth>
<HoleDepth>16</HoleDepth>
<XHoleOffset>261</XHoleOffset>
<YHoleOffset>711.5</YHoleOffset>
</Hole>
<Hole>
<HoleWidth>5.0</HoleWidth>
<HoleDepth>12.5</HoleDepth>
<XHoleOffset>37</XHoleOffset>
<YHoleOffset>72</YHoleOffset>
</Hole>
Marc De Swert
Re: XML File
March 20, 2009 08:23AM
Hi Milton,

We using xml from reading a record an reading line per line and construct line per line an xml file, in the Example the "Name1- 2" are the nameswaht we want, the VAr1 - 2 are coming from the record

XMLDocument("CdeXML" )

IF ErreurDétectée THEN
Erreur("Erreur lors de la création du document XML")
RETOUR
END



XMLParent("CdeXML")
XMLPremier("CdeXML")
XMLFils("CdeXML")
XMLSuivant("CdeXML")
XMLParent("CdeXML")
XMLFils("CdeXML")
XMLAjouteFils("CdeXML", "DrillingData", "", Vrai)

XMLAjouteFils("CdeXML", "Name1", Var1)
XMLAjouteFils("CdeXML", "Name2", Var2)
XMLAjouteFils("CdeXML", "Name3", Var3)
...

lv_FileXML = XMLConstruitChaîne("CdeXML",XMLPositionCourante,XMLEncodageAucun)


fSauveTexte(VarPathToSave +"_" + VarNameDocument" + ".xml", lv_FileXML)

XMLTermine("CdeXML")


Marc :cool:
Milton
Re: XML File
March 20, 2009 06:12PM
Thanks Marc,

I will give it a try

Milton
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: