Difference between revisions of "XML DECODE FILE()"
(Created page with '==Purpose== Function to create a dynamic array (object) from the contents of an XML formatted file ==Syntax== XML_DECODE_FILE(<expC1>,<expC2>,<expC3>) ==See Also== ACLASS()…') |
Barrymavin (Talk | contribs) (→Description) |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[GETURL()]], [[JSON_DECODE()]], [[JSON_DECODE_FILE()]], [[JSON_ENCODE()]], [[LIST CLASSES]], [[LOADOBJECT()]], [[NEWOBJECT()]], [[OBJECT()]], [[POSTURL()]], [[PRINT_JSON()]], [[PRINT_HTML()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[WITH]] | + | [[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[GETURL()]], [[JSON_DECODE()]], [[JSON_DECODE_FILE()]], [[JSON_ENCODE()]], [[LIST CLASSES]], [[LOADOBJECT()]], [[NEWOBJECT()]], [[OBJECT()]], [[POSTURL()]], [[PRINT_JSON()]], [[PRINT_HTML()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[WITH]], [[XML]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]], [[XQUERY()]], [[XQUERY_ATTRIBUTES()]], [[XQUERY_CLOSE()]], [[XQUERY_COUNT()]], [[XQUERY_DECODE()]], [[XQUERY_FILE()]], [[XQUERY_FIND()]], [[XQUERY_NODE()]], [[XQUERY_OPEN()]], [[XQUERY_SELECT()]] |
==Description== | ==Description== | ||
The XML_DECODE_FILE() function is used to create a dynamic array (object) from the contents of an XML formatted file whose filename is specified in <expC1>, tag root in <expC2> and tag row in <expC3>. | The XML_DECODE_FILE() function is used to create a dynamic array (object) from the contents of an XML formatted file whose filename is specified in <expC1>, tag root in <expC2> and tag row in <expC3>. | ||
+ | |||
+ | If you need more power to work with XML files use [[XQUERY_FILE()]] | ||
==Example== | ==Example== | ||
+ | |||
+ | mybooks.xml | ||
+ | <code lang="recital"> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <bookstore> | ||
+ | |||
+ | <book category="COOKING"> | ||
+ | <title lang="en">Pulse</title> | ||
+ | <author>Jenny Chandler</author> | ||
+ | <year>2013</year> | ||
+ | <format>Hardback</format> | ||
+ | </book> | ||
+ | |||
+ | <book category="COOKING"> | ||
+ | <title lang="en">Riverford Farm Cook Book</title> | ||
+ | <author>Guy Watson</author> | ||
+ | <author>Jane Baxter</author> | ||
+ | <year>2008</year> | ||
+ | <format>Paperback</format> | ||
+ | </book> | ||
+ | |||
+ | <book category="CHILDREN"> | ||
+ | <title lang="en">The House At Pooh Corner</title> | ||
+ | <author>A. A. Milne</author> | ||
+ | <year>1928</year> | ||
+ | <format>Hardback</format> | ||
+ | </book> | ||
+ | |||
+ | <book category="CRIME"> | ||
+ | <title lang="en">Knots and Crosses</title> | ||
+ | <author>Ian Rankin</author> | ||
+ | <year>2008</year> | ||
+ | <format>EPUB</format> | ||
+ | </book> | ||
+ | |||
+ | <book category="PHILOSOPHY"> | ||
+ | <title lang="fr">Le mythe de Sisyphe</title> | ||
+ | <author>Albert Camus</author> | ||
+ | <year>1943</year> | ||
+ | <format>Paperback</format> | ||
+ | </book> | ||
+ | |||
+ | </bookstore> | ||
+ | </code> | ||
+ | |||
<code lang="recital"> | <code lang="recital"> | ||
filename = geturl("http://www.myserver.com/getsomepage.rsp?name=smith&month=10", 30, array(), "myfilename.xml") | filename = geturl("http://www.myserver.com/getsomepage.rsp?name=smith&month=10", 30, array(), "myfilename.xml") | ||
myobject = xml_decode_file(filename, "customers", "customer") | myobject = xml_decode_file(filename, "customers", "customer") | ||
+ | |||
+ | mybooks = xml_decode_file("mybooks.xml","bookstore", "book”) | ||
+ | |||
</code> | </code> | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
+ | [[Category:XML]] | ||
+ | [[Category:Data Import]] | ||
+ | [[Category:Data Integration]] |
Latest revision as of 21:24, 11 May 2024
Contents
Purpose
Function to create a dynamic array (object) from the contents of an XML formatted file
Syntax
XML_DECODE_FILE(<expC1>,<expC2>,<expC3>)
See Also
ACLASS(), ADDPROPERTY(), AMEMBERS(), COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, GETURL(), JSON_DECODE(), JSON_DECODE_FILE(), JSON_ENCODE(), LIST CLASSES, LOADOBJECT(), NEWOBJECT(), OBJECT(), POSTURL(), PRINT_JSON(), PRINT_HTML(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, WITH, XML, XML_DECODE(), XML_ENCODE(), XML_GATHER(), XML_SCATTER(), XQUERY(), XQUERY_ATTRIBUTES(), XQUERY_CLOSE(), XQUERY_COUNT(), XQUERY_DECODE(), XQUERY_FILE(), XQUERY_FIND(), XQUERY_NODE(), XQUERY_OPEN(), XQUERY_SELECT()
Description
The XML_DECODE_FILE() function is used to create a dynamic array (object) from the contents of an XML formatted file whose filename is specified in <expC1>, tag root in <expC2> and tag row in <expC3>.
If you need more power to work with XML files use XQUERY_FILE()
Example
mybooks.xml
<?xml version="1.0" encoding="UTF-8"?> <bookstore> <book category="COOKING"> <title lang="en">Pulse</title> <author>Jenny Chandler</author> <year>2013</year> <format>Hardback</format> </book> <book category="COOKING"> <title lang="en">Riverford Farm Cook Book</title> <author>Guy Watson</author> <author>Jane Baxter</author> <year>2008</year> <format>Paperback</format> </book> <book category="CHILDREN"> <title lang="en">The House At Pooh Corner</title> <author>A. A. Milne</author> <year>1928</year> <format>Hardback</format> </book> <book category="CRIME"> <title lang="en">Knots and Crosses</title> <author>Ian Rankin</author> <year>2008</year> <format>EPUB</format> </book> <book category="PHILOSOPHY"> <title lang="fr">Le mythe de Sisyphe</title> <author>Albert Camus</author> <year>1943</year> <format>Paperback</format> </book> </bookstore>
filename = geturl("http://www.myserver.com/getsomepage.rsp?name=smith&month=10", 30, array(), "myfilename.xml") myobject = xml_decode_file(filename, "customers", "customer") mybooks = xml_decode_file("mybooks.xml","bookstore", "book”)