Difference between revisions of "XML DECODE FILE()"

From Lianjapedia
Jump to: navigation, search
(Example)
(Example)
Line 61: Line 61:
 
myobject = xml_decode_file(filename, "customers", "customer")
 
myobject = xml_decode_file(filename, "customers", "customer")
  
mybooks = xml_decode_file(“mybooks.xml”, "bookstore", "books”)
+
mybooks = xml_decode_file("mybooks.xml","bookstore", "books”)
  
 
</code>
 
</code>

Revision as of 21:16, 11 May 2024

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>.

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", "books”)