Baanboard.com

Go Back   Baanboard.com

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
17%
200 - 500 GB
17%
500 - 800 GB
6%
800 - 1200 GB
6%
1200 - 1500 GB
17%
1500 - 2000 GB
17%
> 2000 GB
22%
Total votes: 18

Baanboard at LinkedIn


Reference Content

 
Example XML generation
By patvdv at 26 Feb 2008 - 21:57

Example XML generation

Below a piece of Baan-C code is shown for generating an XML document. For ease of reading, no checking on the return codes of the functions is done.

 long    cmfId, identId, recipientsId, fromId, dtdId
 long    fd, retVal

 |Create the doctype element and populate its contents
 dtdId = xmlNewNode("CMF", XML_DTD)
 retVal = xmlsetAttribute(dtdId,  "NAMEURL", "cmf1.dtd")

 |Create the root element and make it a right sibling of the XML_DTD node.
 cmfId = xmlNewNode("CMF" )
 retVal = xmlAdd(dtdId, cmfId )

 |Create IDENTIFICATION element and add its attributes
 identId = xmlNewNode("IDENTIFICATION", XML_ELEMENT, cmfId)

 retVal = xmlSetAttribute (identId,  "MESSAGE-ID", "34a98u0erirori" )
 retVal = xmlSetAttribute(identId,   "CLASS", "order" )
 retVal = xmlSetAttribute(identId,   "SUBJECT", "Subject string" )

 |Create RECIPIENTS element
 recipientsId = xmlNewNode("RECIPIENTS", XML_ELEMENT, cmfId)

 |Create FROM element and add its attributes
 fromId = xmlNewNode("FROM", XML_ELEMENT, recipientsId)

 retVal = xmlSetAttribute(fromId,  "NAME", "Wiebe Riphagen" )
 retVal = xmlSetAttribute(fromId,  "TYPE", "SMTP" )
 retVal = xmlSetAttribute(fromId,  "ADDRESS", "wriphagen@baan.nl" )

 |Open a file for write and store the XML document
 fd = seq.open("/home/wriphag/file.xml", "w" )
 xmlWritePretty(fd, dtdId, 0 )
 seq.close(fd)

 |Free the complete XML object from memory
 xmlDelete(dtdId, 0)

The resulting XML-document is shown below:

 <?xml version="1.0"?>
 <!DOCTYPE CMF SYSTEM "cmf1.dtd">
 <CMF>
         <IDENTIFICATION
                 MESSAGE-ID="34a98u0erirori"
                 CLASS="order"
                 SUBJECT="Subject string"
         />
         <RECIPIENTS>
                 <FROM
                         NAME="Wiebe Riphagen"
                         TYPE="SMTP"
                         ADDRESS="wriphagen@baan.nl"
                 />
         </RECIPIENTS>
 </CMF>

Related topics


0
No votes yet


All times are GMT +2. The time now is 14:11.


©2001-2018 - Baanboard.com - Baanforums.com