aneesh_av
12th March 2002, 08:24
:) Hi,
How we can generate XML data from BaaN 4c and BaaN 5c? Is there any technichal documentation papers for BaaN4c or 5 on XML technolgy?
Youp2001
12th March 2002, 12:28
There is a 'XML API' object in Baan (at least in ERP). I haven't had the change to do something with it but it exists and it is documented (in BaanERP).
If you have a recent / up-to date helpfile for the BaanERP tools you should be able to find the documentation you're looking for
Below you find the overview helptext for the XML object API.
Regards,
Youp
XML Object API: Overview
The XML Object API consists of a set of 3GL functions for creating, accessing, and destroying an XML object.
XML object structure
An XML object represents a document as a tree consisting of one or more nodes. There are four node types:
- A node that describes an XML element (XML_NTYPE_ELEMENT).
- A node that describes an XML DTD (XML_NTYPE_DTD).
- A node that describes an XML data item (XML_NTYPE_DATA).
- A node that describes an XML processing instruction (XML_NTYPE_PI).
Nodes of type XML_NTYPE_ELEMENT and XML_NTYPE_DTD can be either nodes or leaves in the tree. So nodes of these types can have child nodes. Nodes of these types can also have attributes assigned to them.
Nodes of type XML_NTYPE_DATA and XML_NTYPE_PI are always leaf nodes and so cannot have any child nodes.
When you create a node, it is assigned an ID that is unique within the scope of one instantiation of a Baan VM. So nodes can be passed to other 3GL processes running inside the same Baan VM but cannot be passed to a process running in another Baan VM.
Multi-process issues
For passing XML nodes to other Baan VM processes, the following restrictions apply:
- There is always one owner process of an XML tree.
- Only the owner process can change or delete an XML tree or parts of an XML tree. Other processes in the same Baan VM have only read access to the tree.
- When the owner process of an XML tree exits, the XML tree is implicitly deleted. This means that other processes with references to the tree can no longer use the references.
- A process becomes the owner of an XML tree by calling one of the following functions:
* xml.read()
* xml.newNode()
* xml.duplicateNode() (without specifying a process ID)
* xml.findNodes()
* xml.findSetOfSiblingNodes()
- A process can transfer ownership of a copy of an XML tree to another 3GL process by calling xml.duplicateNode() and specifying the process ID of the new owner process.
White-space handling
By default, decorative white-space in element content is not preserved when an XML document is parsed. Decorative white-space is element content that consists exclusively of white-space characters (space, tab, or newline characters). When white-space in the element content of a particular element must be preserved, the attribute xml:space must be set to 'preserve'. When this attribute is omitted or has the value 'default', decorative white-space is ignored.
Using the XML Object API functions
XML generation
You use the xml.newNode() function to create a new node of any type. The first node you create is automatically positioned at the top of the tree hierarchy. For all other nodes you create, you must explicitly add them to the tree at a particular position. To add a node with reference to a sibling node, you use the xml.insertNode() or xml.addNode() functions. To add a node as a child of another node, you use the xml.appendChildNode() function.
To change the position of a node in the tree hierarchy, you must first call xml.unlinkNode() to unlink the node from the tree. You can then call either xml.insertNode(), xml.addNode(), or xml.appendChildNode() to add the node back into the tree at a different position.
You use the xml.deleteNode() function to delete a node and all its child nodes. Deleting the root node (that is, the first node in the tree hierarchy) causes the entire XML tree to be freed from memory.
With the xml.duplicateNode() function, you can create a copy of any node (and all its child nodes), and you can, optionally, pass ownership of the new node and all its child nodes to a different 3GL process running within the same Baan VM.
To set the properties of a particular node, you use the xml.setNodeProperties() function. To subsequently delete a property, you use the xml.deleteNodeProperties() function.
When the complete XML object has been generated, you use the xml.write() function to write the resulting XML document to a file.
Generating an XML document with a DTD
You can generate an XML document with a Document Type Definition (DTD) by creating a document type element, as follows:
xml.newNode( "name", XML_NTYPE_DTD, nodeId )
For the document type element of an XML object, the following mapping rules apply:
- The name of the DTD element is the name of the document type definition.
- The value of the optional attribute NAMEURL is the value of the SystemLiteral part of the XML expression ExternalID. The value of the optional attribute NAMEPUBLICID is the value of the PubidLiteral part of the XML expression ExternalID.
- When attribute NAMEURL is defined and attribute NAMEPUBLICID is not defined, the XML expression ExternalID takes the form:
SYSTEM SystemLiteral
When both attributes are defined, the XML expression ExternalID takes the form:
PUBLIC PubidLiteral SystemLiteral
- A DTD element cannot have child elements.
- When data is added to a DTD element, this is written as-is to the XML document. The generator does not generate XML tags for the declarations.
XML parsing
You use the xml.read() function to parse an XML document and convert it to an XML object. To obtain the node IDs for particular named nodes, you can use either the xml.findFirstNode(), xml.findNodes(), or xml.findSetOfSiblingNodes() functions. To retrieve the properties of a particular node, you use the xml.getNodeProperties() function. When you have finished with a particular XML tree, you use xml.deleteNode() to remove it from memory.
Note that no document type element is created when an XML document is parsed.
msjumbu
15th March 2002, 16:45
hi where can i get more information about this?
Youp2001
19th March 2002, 10:37
It is part of the baan tools programmers reference which is available as windows help file.
Youp
msjumbu
19th March 2002, 14:07
Hi,
But when I checked the windows help which i have, I could not find it anywhere :(
Jeyaseelan
19th March 2002, 14:36
XML API Object presents only in BaaN V. In the lower versions of BaaN V there is no inbuilt support for handling XML Object. If u install Open World (OW) adapter in any BaaN IV systems u can able to handle XML objects.
RAMSBaan
20th March 2002, 03:52
Hi,
May be you might be having a older version of tools manual.
In New Version you can find the help for XML objects, which is most used in Association with BCBE or OW
Regards
Ram
:)
msjumbu
24th March 2002, 10:03
Hi where can I find the latest tools manual for baan IV
Renegade
27th March 2002, 08:36
is RAMSbaan Ramesh Mani?
Jurrien
2nd April 2002, 18:28
In Baan ERP Corelli (SP7) you can create a device to print to XML. It is one of the options in "maintain devices".
Jurrien
Dwallace
19th April 2002, 22:12
With the Open World adapter on Baan IVCc4, can I translate inbound XML or just create outbound?
We are currently interested in an external translator. Is Baan's Open World Adapter cost prohibitive compared to an stand-alone translator?
Denise
bizen99
23rd April 2003, 13:48
Hi,
how can i create xml files without use spool.device="XML"?
is it with functions like 'xml.newNode'?
Can anybody put a small example, please?
thanks
NPRao
23rd April 2003, 20:54
Refer to -
Example XML generation (http://www.baanboard.com/programmers_manual_baanerp_help_functions_xml_example_xml_generation)
Example XML parsing (http://www.baanboard.com/programmers_manual_baanerp_help_functions_xml_example_xml_parsing)
bizen99
25th April 2003, 17:07
thanks a lot
I didn'y have any actual manual of tools
bye
sant123
4th November 2003, 20:48
Prashant,
can we use the xml APIs ( Parser & generator) in 4C4.??
NPRao
4th November 2003, 22:00
Sant,
I do not have access to BaaN-4 so you just have to give it a try and find it out yourself.
Refer to the example programs in the library on the board -
Example XML generation (http://www.baanboard.com/programmers_manual_baanerp_help_functions_xml_example_xml_generation)
Andre.A
5th November 2003, 11:34
Hi,
I have implmented XML read/write in a DLL on Baan 4 and 5.
The main idea was to change from a flat file interface to a more failure resist interface. We developed it with Open World connectivity.
If you want I could send you some details of my implementation.
You could use XML functions in Baan 4 like in Baan 5, there is no difference between.
regards
sant123
5th November 2003, 21:01
Andre,
appreciate if you could send in more details or documents.
Thanks
Andre.A
6th November 2003, 10:40
Hi !
I don“t want to post the whole dll in advance. I thought If anyone is interested for specific help I could help him.
Please ask a specific question than I could answer in a helpfull manor.
cu
tigerente
18th November 2004, 14:44
Read the message from Baan support:
XML API is supported on BaanIV/Triton, minimum portingset version:
6.1c.07.02, recommended 6.1c.07.05 or up 2. we will provide a solution describing the usage and limitations of the XML API
Regards
VanessaBR
17th August 2005, 19:40
Hello guys,
do you know one xml parse command without open a file ?
I need to read a XML string for example, comming as argument in a function,
like this:
function extern read.xml.document(string xml.str.i(10000))
{
|* Parse the xml file
xml.id = xmlread(fd, error_string)
I need to read the _xml.stri variable, not a file from unix ...
is it possible ??
thanks
tigerente
18th August 2005, 09:40
Sorry, no idea.
Andre.A
18th August 2005, 10:32
Hello Vanessa,
try the function:
long xmlReadFromString(string xmlString, ref string error, [ long whitespacehandling ] )
Description:
De-serialize an XML object by parsing an XML document and creating an in-memory object tree.
Parameters:
xmlString xmlString must be a string buffer which contains an XML document.
error error contains a description of the error in case a parsing error occurs. This is an English text, which can be used for logging purposes. Maximum length of this error string is 120 characters.
whitespacehandling whitespacehandling can have one of the three values XmlWhiteSpaceLegacyMode, XmlPreserveWhiteSpace, and XmlReplaceWhiteSpaceBySingleSpace. When this optional argument is not supplied, the value XmlWhiteSpaceLegacyMode is assumed. The meaning of the allowed values is as follows. XmlWhiteSpaceLegacyMode XmlWhiteSpaceLegacyMode means that white space is handled the same way as it was done in older versions of these functions, which did not have the whitespacehandling argument. This means (1) that each newline character in the input starts a new data node, (2) that leading white space in a data node is removed, and (3) that empty data nodes are removed.
XmlPreserveWhiteSpace XmlPreserveWhiteSpace means that all white space in the XML document is preserved. However, it should be noted that any carriage-return line-feed character pair and any carriage-return character that is not followed by a line-feed character is translated to a single line-feed character. See also [XMLSTD], section 2.11.
XmlReplaceWhiteSpaceBySingleSpace XmlReplaceWhiteSpaceBySingleSpace means (1) that leading and trailing white space in a data node is removed, (2) that empty data nodes are removed, and (3) that internal white space in a data node is replaced by one single space character.
It is possible to switch between the two modes XmlPreserveWhiteSpace and XmlReplaceWhiteSpaceBySingleSpace by means of the xml:space attribute. The value "preserve" switches the mode to XmlPreserveWhiteSpace. The value "default" (or any other value than "preserve") switches the mode to XmlReplaceWhiteSpaceBySingleSpace. The value of the xml:space attribute is considered to apply to all elements within the content of the element where it is specified, unless overriden with another instance of the xml:space attribute. See also [XMLSTD], Section 2.10.
In XmlWhiteSpaceLegacyMode, the xml:space attribute is ignored.
Return values
Success; A reference to the first in-memory node when successful.
0 Error.
best regards
VanessaBR
18th August 2005, 17:50
Hello Andre,
thanks a lot for your prompt answer.
I'll do some tests and let's see if this thing works fine, thanks.
So, how can I get these XML guides ?
Another issue:
I'm in a project to generate and receive XML files from Webservices.
To receive and read the files, I'll try to do using your help.
To send the files, I did one function that generates the tags manually and return strings. It's working fine, no problem until now and the webservices can read these files, except that I had to control the size which is limited by Baan in 4096 bytes.
Do you know how can I return the object directly to the Webservices,
Instead of returns strings ??
I did one function using xmlNewNode command and I could create the XML file as well, but I don't know how can I return this at function as object type.
best regards,
Vanessa :confused:
Andre.A
18th August 2005, 18:13
Hello Vanessa,
where did you see this limitation of 4096 bytes ?
I got the SSA ERP LN 6.1 Programmers Guide for XML only. It is available on the
baan support website.
I think you have to handle the output as a large string. The object itself is located in the Baan VM memory where I belief no direct access is possible.
The xmlnewnode function generates a new object and gives you a long variable which is the handle to this new object. then you are able to add, modify , or delete nodes inside this object with baan commands.
best regards
VanessaBR
18th August 2005, 18:23
Hello Andre,
I did a lot of tests with webservices, after all, I did one simple test,
try to create a variable string with size (10000) for example, then,
try to fill it with at least "4100" positions....
Baan cannot compile this program. Please check it out the attached file.
regards,
Vanessa
Andre.A
18th August 2005, 18:33
Hello Vanessa,
I tried this
string test(10000)
for i = 1 to 5000
test = test & "A"
endfor
it works without any compile error. Which service pack level is your baan. We have 16 now and porting set Corelli-wt, build 1179 ( 2004/10/06 13:16)
best regards