ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(B) (C/S) |
Section for use
All.
Syntax
XML_CREATE_NODE XmlIdentifierName NodeType NodeName NSUse NSDeclaration
NodeType |
→ |
*CHILD|*SIBLING |
NodeName |
→ |
<AlphaConstant> | <alpha variable> |
NSUse |
→ |
*NS(Prefix) | None |
NSDeclaration |
→ |
*DECL_NS(SeriesNamespacePrefixWithDefault) | None |
SeriesPrefixNamespaceWithDefault |
→ |
SeriesNamespacePrefixWithDefault, Default Prefix | Default Prefix |
Prefix |
→ |
<AlphaConstant> |
Default |
→ |
*DFT | None |
Description
Creates a child or sibling node based on the current node. The created node becomes the new current node.
The *NS parameter allows to assign a namespace to a node. The node name is prefixed by the prefix associated with the namespace, unless the prefix corresponds to the default namespace.
The *DECL_NS parameter allows to force the declaration of one or several namespaces for a node. These namespaces must be previously defined using the XML_ADD_NS instruction. The *DFT option allows to specify that it is the namespace by default.
The *DFT option can be used only once.
When this instruction is executed, the *RETURN_CODE reserved word can take the following values:
0 (*NORMAL) |
Operation completed successfully. |
5 |
Error while creating the node. |
7 |
Error while creating the root node. |
13 |
Error: XML identifier not open. |
27 |
Error: prefix used in *DECL_NS does not correspond to any namespace defined via XML_ADD_NS. |
Example
XML_CREATE_NODE xml1 *CHILD 'root'
XML_CREATE_NODE xml1 *CHILD 'FirstRootChild'
XML_SET_VAL xml1 'text of FirstRootChild'
XML_CREATE_NODE xml1 *SIBLING 'FirstRootChild'
XML_SET_VAL xml1 'text of second FirstRootChild'
XML_SELECT xml1 ..
XML_CREATE_NODE xml1 *CHILD 'SecondRootChild'
XML_SET_VAL xml1 'text of SecondRootChild'
Examples with *NS and *DECL_NS:
The three examples of using the XML_CREATE_NODE given here below are valid only if the namespaces corresponding to the "typ" and "xro" prefixes were defined via the following XML_ADD_NS instructions:
XML_ADD_NS MyXml 'typ' 'http://types.hardis.com'
XML_ADD_NS MyXml 'xro' 'http://xroutes.hardis.com'
XML_CREATE_NODE MyXml *FILS 'NodeName' *DECL_NS ('typ' , 'xro')
→ |
<NodeName xmlns:typ="http://types.hardis.com" xmlns:xro="http://xroute.hardis.com"> |
XML_CREATE_NODE MonXml *FILS 'nomNoeud' *NS('typ')
→ |
<typ:NodeName> |
XML_CREATE_NODE MyXml *CHILD 'NodeName' *NS('typ') *DECL_NS('typ' *DFT)
→ |
<NodeName xmlns="http://types.hardis.com"> |