XMLTODYN
XMLTODYN converts the XML to a dynamic array using the optional XSL.
COMMAND SYNTAX
XMLTODYN(XML, XSL, result)
SYNTAX ELEMENTS
Array = XMLTODYN(XML,XSL,result)
If result = 0 Array will contain a dynamic array built from the xml / xsl
If result <> 0, Array will contain an error message
There is no requirement for xsl if you are reconverting from generic xml to dynarray
a = "Tom" : @AM : "Dick" : @AM : "Harry" xml = DYNTOXML(a, '', result) b = XMLTODYN(xml, '', result CRT CHANGE(b, @AM, ' ')
Screen output:
Tom Dick Harry
If passing a stylesheet in the second parameter, it performs a transform to give a different format of the array.
XML CONTENTS
<?xml version="1.0" encoding="UTF-8"?>
<mycustomer>
<firstname>Tom</firstname>
<lastname>Dick</lastname>
<address>Harry</address>
</mycustomer>
EXAMPLE
a = XMLTODYN(xml, xsl, rc) CRT CHANGE(a, @AM, ' ')
XSL CONTENTS
<xsl:template match="mycustomer">
<array>
<xsl:apply-templates/>
</array>
</xsl:template>
<xsl:template match="firstname">
<data>
<xsl:attribute name="attribute">1</xsl:attribute>
<xsl:attribute name="value">
<xsl:number level="single"/>
</xsl:attribute>
<xsl:attribute name="subvalue">1</xsl:attribute>
<xsl:value-of select="."/>
</data>
</xsl:template>
Etc
Last update: Sat, 16 Jul 2022 15:34