MoneyWorks Manual
Edit
!--sphider_noindex-->
BeginXMLElement (xml_hndl, element_name [, attributesArray])
Result type: none
Definition: Emit an opening element tag, optionally with attributes.
Example:
let xml = CreateXMLDoc() // currently no output path, get as string via FinaliseXMLDoc BeginXMLElement(xml, "import", CreateArray("table", "transaction")) BeginXMLElement(xml, "transaction") AddXMLElement(xml, "ourref", "12345") AddXMLElement(xml, "transdate", Today()) AddXMLElement(xml, "lastmodifiedtime", Time()) AddXMLElement(xml, "gross", 12345.67, CreateArray("arbitrary_attribute", "decimal")) AddXMLElement(xml, "description", "Something with < & > in it and also some ctrl characters\n\n\tand formatting.") AddXMLElement(xml, "description", "Something with < & > in it and also some ctrl characters\n\n\tand formatting.", NULL, true) // encapsulate as CDATA EndXMLElement(xml, "transaction") EndXMLElement(xml, "import") let t = FinaliseXMLDoc(xml)
xmltext is formatted thus:
<?xml version="1.0"?> <import table="transaction"> <transaction> <ourref>12345</ourref> <transdate>20250131</transdate> <lastmodifiedtime>20200925145334</lastmodifiedtime> <gross arbitrary_attribute="decimal">12345.67</gross> <description>Something with < & > in it and also some ctrl characters 	and formatting.</description> <description><![CDATA[Something with < & > in it and also some ctrl characters and formatting.]]></description> </transaction> </import>
Note that numbers are formatted in POSIX format (decimal point and no thousands separators), and times and dates are big-endian.
See Also:
AddXMLElement: Write an element to an XML document handle
CreateXMLDoc: Create an XML document handle
EndXMLElement: Write a closing tag to an XML document
FinaliseXMLDoc: Get the finished XML as a string