Please enable JavaScript to view this site.

CMDebug / TCC-RT Help v. 27

@XMLSTARTELEMENTname,namespaceURI] : Writes the opening tag of a new XML element. 

 

Writes the opening tag of a new XML element. If an XML element is already opened, then this element is written as a child.

If name is a local name without a prefix, the class will automatically introduce a new xmlns="NamespaceURI" attribute if necessary.

If name is in the form prefix:local, then class will automatically introduce a new xmlns:prefix="NamespaceURI" as necessary.

When calling @XMLPutElement or @XMLStartElement, if a NamespaceURI is not specified an empty namespace will be defined for the element. If a namespace should be associated with the element, a NamespaceURI value must be provided. When creating the XML, the class will determine if the namespace already exists to avoid duplicate definitions of the same namespace.

Returns 0 on success, or an XML error on failure;

 

For example, to create this XML:

 

<book xmlns='urn:loc.gov:books' xmlns:isbn='urn:ISBN:0-395-36341-6'>

<title>Cheaper by the Dozen</title>

<isbn:number>1568491379</isbn:number>

</book>

 

Use the code:

 

echo %@xmlstartelement["book","urn:loc.gov:books"]

echo %@xmlputattr["xmlns:isbn","","urn:ISBN:0-395-36341-6"]

echo %@xmlputelement["title,"urn:loc.gov:books","Cheaper by the Dozen"]

echo %@xmlputelement["isbn:number", "urn:ISBN:0-395-36341-6", "1568491379");

echo %@xmlclose[]

 

XML Errors:

 

101 Invalid attribute index

102 No attributes available

103 Invalid namespace index

104 No namespaces available

105 Invalid element index

106 No elements available

107 Attribute does not exist

201 Unbalanced element tag

202 Unknown element prefix (can't find namespace)

203 Unknown attribute prefix (can't find namespace)

204 Invalid XML markup

205 Invalid end state for parser

206 Document contains unbalanced elements

207 Invalid XPath

208 No such child

209 Top element does not match start of path

210 DOM tree unavailable

302 Can't open file

401 Invalid XML would be generated

402 An invalid XML name has been specified