Difference between revisions of "XQUERY OPEN()"
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
− | Used to open XML files for parsing using | + | Used to open XML files for parsing using XPath notation |
==Syntax== | ==Syntax== | ||
Line 6: | Line 6: | ||
==See Also== | ==See Also== | ||
− | [[MQCLOSE()]], [[MQCREATE()]], [[MQCURMSGS()]], [[MQOPEN()]], [[MQSEND()]], [[MQRECEIVE()]], [[MQUNLINK()]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]], [[XQUERY()]], [[XQUERY_CLOSE()]], [[XQUERY_COUNT()]], [[XQUERY_DECODE()]], [[XQUERY_FILE()]], [[XQUERY_NODE()]], [[XQUERY_SELECT()]] | + | [[MQCLOSE()]], [[MQCREATE()]], [[MQCURMSGS()]], [[MQOPEN()]], [[MQSEND()]], [[MQRECEIVE()]], [[MQUNLINK()]], [[PRINT XML()]], [[XML]], [[XML_DECODE()]], [[XML_DECODE_FILE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]], [[XQUERY()]], [[XQUERY_ATTRIBUTES()]], [[XQUERY_CLOSE()]], [[XQUERY_COUNT()]], [[XQUERY_DECODE()]], [[XQUERY_FILE()]], [[XQUERY_FIND()]], [[XQUERY_NODE()]], [[XQUERY_SELECT()]] |
==Description== | ==Description== | ||
− | The XQUERY_OPEN() function is used to open an XML file for parsing using | + | The XQUERY_OPEN() function is used to open an XML file for parsing using XPath notation. The character expression <expC1> is the XML file. |
− | + | XQuery functions: | |
− | After opening using XQUERY_OPEN(), the XQUERY_NODE() | + | The XQUERY_OPEN() function is used to open an XML file for parsing using XPath notation. After opening using XQUERY_OPEN(), the XQUERY_FIND() or XQUERY_NODE() functions can be used to find and return a specified XML node value. The XQUERY_ATTRIBUTES() function finds and returns a complete node and its attributes. XQUERY_COUNT() returns a count of a specified XML node. The XQUERY_SELECT() function provides the ability to query nodes by attribute and value. The XQUERY_CLOSE() function is closes the XML file. |
− | The XQUERY() function is used to parse XML strings using | + | The XQUERY() function is used to parse XML strings using XPath notation. |
− | The XQUERY_FILE() function is used to parse XML files using | + | The XQUERY_FILE() function is used to parse XML files using XPath notation. |
The XQUERY_DECODE() function is used to return an object from an XML string. | The XQUERY_DECODE() function is used to return an object from an XML string. | ||
Line 107: | Line 107: | ||
[[Category:Lianja VFP Extensions]] | [[Category:Lianja VFP Extensions]] | ||
[[Category:VFP Function Extensions]] | [[Category:VFP Function Extensions]] | ||
− | [[Category:Lianja | + | [[Category:Lianja v3.0]] |
Latest revision as of 05:10, 26 July 2016
Contents
Purpose
Used to open XML files for parsing using XPath notation
Syntax
XQUERY_OPEN(<expC1>)
See Also
MQCLOSE(), MQCREATE(), MQCURMSGS(), MQOPEN(), MQSEND(), MQRECEIVE(), MQUNLINK(), PRINT XML(), XML, XML_DECODE(), XML_DECODE_FILE(), XML_ENCODE(), XML_GATHER(), XML_SCATTER(), XQUERY(), XQUERY_ATTRIBUTES(), XQUERY_CLOSE(), XQUERY_COUNT(), XQUERY_DECODE(), XQUERY_FILE(), XQUERY_FIND(), XQUERY_NODE(), XQUERY_SELECT()
Description
The XQUERY_OPEN() function is used to open an XML file for parsing using XPath notation. The character expression <expC1> is the XML file.
XQuery functions:
The XQUERY_OPEN() function is used to open an XML file for parsing using XPath notation. After opening using XQUERY_OPEN(), the XQUERY_FIND() or XQUERY_NODE() functions can be used to find and return a specified XML node value. The XQUERY_ATTRIBUTES() function finds and returns a complete node and its attributes. XQUERY_COUNT() returns a count of a specified XML node. The XQUERY_SELECT() function provides the ability to query nodes by attribute and value. The XQUERY_CLOSE() function is closes the XML file.
The XQUERY() function is used to parse XML strings using XPath notation.
The XQUERY_FILE() function is used to parse XML files using XPath notation.
The XQUERY_DECODE() function is used to return an object from an XML string.
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>
// Examples using mybooks.xml xquery_open("mybooks.xml") nCount = xquery_count("/bookstore/book") for i=1 to nCount cTitle = xquery_node("/bookstore/book[&i]/title") ? cTitle endfor xquery_close() Pulse Riverford Farm Cook Book The House At Pooh Corner Knots and Crosses Le mythe de Sisyphe xquery_open("mybooks.xml") nCount = xquery_count("/bookstore/book") for i=1 to nCount nCountAuthor = xquery_count("/bookstore/book[&i]/author") for j = 1 to nCountAuthor cAuthor = xquery_node("/bookstore/book[&i]/author[&j]") ? cAuthor endfor endfor xquery_close() Jenny Chandler Guy Watson Jane Baxter A. A. Milne Ian Rankin Albert Camus