XQUERY DECODE()

From Lianjapedia
Revision as of 09:05, 16 February 2016 by Yvonne.milne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Used to return an object from the specified XML string

Syntax

XQUERY_DECODE(<expC1>)

See Also

MQCLOSE(), MQCREATE(), MQCURMSGS(), MQOPEN(), MQSEND(), MQRECEIVE(), MQUNLINK(), XML_DECODE(), XML_ENCODE(), XML_GATHER(), XML_SCATTER(), XQUERY(), XQUERY_CLOSE(), XQUERY_COUNT(), XQUERY_FILE(), XQUERY_FIND(), XQUERY_OPEN()

Description

The XQUERY_DECODE() function is used to return an object from the specified XML string. The character expression <expC1> is the 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>
// Example using mybooks.xml
xquery_open("mybooks.xml")
nCount = xquery_count("/bookstore/book")
for i=1 to nCount
   oBook = xquery_find("/bookstore/book[&i]")
   ? xquery_decode(oBook)
endfor
xquery_close()
 
Dynarray (refcnt=0)
(
    [title] => Pulse
    [title_lang] => en
    [author] => Jenny Chandler
    [year] => 2013
    [format] => Hardback
)
 
Dynarray (refcnt=0)
(
    [title] => Riverford Farm Cook Book
    [title_lang] => en
    [author] => Jane Baxter
    [year] => 2008
    [format] => Paperback
)
 
Dynarray (refcnt=0)
(
    [title] => The House At Pooh Corner
    [title_lang] => en
    [author] => A. A. Milne
    [year] => 1928
    [format] => Hardback
)
 
Dynarray (refcnt=0)
(
    [title] => Knots and Crosses
    [title_lang] => en
    [author] => Ian Rankin
    [year] => 2008
    [format] => EPUB
)
 
Dynarray (refcnt=0)
(
    [title] => Le mythe de Sisyphe
    [title_lang] => fr
    [author] => Albert Camus
    [year] => 1943
    [format] => Paperback
)