Difference between revisions of "XQUERY DECODE()"

From Lianjapedia
Jump to: navigation, search
Line 9: Line 9:
  
 
==Description==
 
==Description==
The XQUERY_DECODE() function is used to return an object from the specified XML string.  The character expression <expC1> is the XML string.
+
The XQUERY_DECODE() function is used to return an object from the specified XML string, including attributes.  The character expression <expC1> is the XML string.
  
 
Other XQuery functions available:
 
Other XQuery functions available:
Line 73: Line 73:
 
endfor
 
endfor
 
xquery_close()
 
xquery_close()
 +
  
 
Dynarray (refcnt=0)
 
Dynarray (refcnt=0)
 
(
 
(
     [title] => Pulse
+
     [book] => Dynarray (refcnt=1)
    [title_lang] => en
+
        (
    [author] => Jenny Chandler
+
            [1] => Dynarray (refcnt=1)
    [year] => 2013
+
                (
    [format] => Hardback
+
                    [title] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Pulse
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                    [lang] => en
 +
                                )
 +
                        )
 +
                    [author] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Jenny Chandler
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [year] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => 2013
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [format] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Hardback
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [attributes] => Dynarray (refcnt=1)
 +
                        (
 +
                            [category] => COOKING
 +
                        )
 +
                )
 +
        )
 
)
 
)
  
 
Dynarray (refcnt=0)
 
Dynarray (refcnt=0)
 
(
 
(
     [title] => Riverford Farm Cook Book
+
     [book] => Dynarray (refcnt=1)
    [title_lang] => en
+
        (
    [author] => Jane Baxter
+
            [1] => Dynarray (refcnt=1)
    [year] => 2008
+
                (
    [format] => Paperback
+
                    [title] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Riverford Farm Cook Book
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                    [lang] => en
 +
                                )
 +
                        )
 +
                    [author] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Jane Baxter
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [year] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => 2008
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [format] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Paperback
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [attributes] => Dynarray (refcnt=1)
 +
                        (
 +
                            [category] => COOKING
 +
                        )
 +
                )
 +
        )
 
)
 
)
  
 
Dynarray (refcnt=0)
 
Dynarray (refcnt=0)
 
(
 
(
     [title] => The House At Pooh Corner
+
     [book] => Dynarray (refcnt=1)
    [title_lang] => en
+
        (
    [author] => A. A. Milne
+
            [1] => Dynarray (refcnt=1)
    [year] => 1928
+
                (
    [format] => Hardback
+
                    [title] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => The House At Pooh Corner
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                    [lang] => en
 +
                                )
 +
                        )
 +
                    [author] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => A. A. Milne
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [year] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => 1928
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [format] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Hardback
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [attributes] => Dynarray (refcnt=1)
 +
                        (
 +
                            [category] => CHILDREN
 +
                        )
 +
                )
 +
        )
 
)
 
)
  
 
Dynarray (refcnt=0)
 
Dynarray (refcnt=0)
 
(
 
(
     [title] => Knots and Crosses
+
     [book] => Dynarray (refcnt=1)
    [title_lang] => en
+
        (
    [author] => Ian Rankin
+
            [1] => Dynarray (refcnt=1)
    [year] => 2008
+
                (
    [format] => EPUB
+
                    [title] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Knots and Crosses
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                    [lang] => en
 +
                                )
 +
                        )
 +
                    [author] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Ian Rankin
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [year] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => 2008
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [format] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => EPUB
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [attributes] => Dynarray (refcnt=1)
 +
                        (
 +
                            [category] => CRIME
 +
                        )
 +
                )
 +
        )
 
)
 
)
  
 
Dynarray (refcnt=0)
 
Dynarray (refcnt=0)
 
(
 
(
     [title] => Le mythe de Sisyphe
+
     [book] => Dynarray (refcnt=1)
    [title_lang] => fr
+
        (
    [author] => Albert Camus
+
            [1] => Dynarray (refcnt=1)
    [year] => 1943
+
                (
    [format] => Paperback
+
                    [title] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Le mythe de Sisyphe
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                    [lang] => fr
 +
                                )
 +
                        )
 +
                    [author] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Albert Camus
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [year] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => 1943
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [format] => Dynarray (refcnt=1)
 +
                        (
 +
                            [text] => Paperback
 +
                            [attributes] => Dynarray (refcnt=1)
 +
                                (
 +
                                )
 +
                        )
 +
                    [attributes] => Dynarray (refcnt=1)
 +
                        (
 +
                            [category] => PHILOSOPHY
 +
                        )
 +
                )
 +
        )
 
)
 
)
 +
  
 
</code>
 
</code>

Revision as of 11:58, 26 February 2016

Purpose

Used to return an object from a 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_NODE(), XQUERY_OPEN(), XQUERY_SELECT()

Description

The XQUERY_DECODE() function is used to return an object from the specified XML string, including attributes. The character expression <expC1> is the XML string.

Other XQuery functions available:

The XQUERY_OPEN() function is used to open an XML file for parsing using XQuery notation. After opening using XQUERY_OPEN(), the XQUERY_NODE() function can be used to search for a specified XML node and XQUERY_COUNT() to return 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 used to close the XML file.

The XQUERY() function is used to parse XML strings using XQuery notation.

The XQUERY_FILE() function is used to parse XML files using XQuery notation.

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_node("/bookstore/book[&i]")
   ? xquery_decode(oBook)
endfor
xquery_close()
 
 
Dynarray (refcnt=0)
(
    [book] => Dynarray (refcnt=1)
        (
            [1] => Dynarray (refcnt=1)
                (
                    [title] => Dynarray (refcnt=1)
                        (
                            [text] => Pulse
                            [attributes] => Dynarray (refcnt=1)
                                (
                                    [lang] => en
                                )
                        )
                    [author] => Dynarray (refcnt=1)
                        (
                            [text] => Jenny Chandler
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [year] => Dynarray (refcnt=1)
                        (
                            [text] => 2013
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [format] => Dynarray (refcnt=1)
                        (
                            [text] => Hardback
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [attributes] => Dynarray (refcnt=1)
                        (
                            [category] => COOKING
                        )
                )
        )
)
 
Dynarray (refcnt=0)
(
    [book] => Dynarray (refcnt=1)
        (
            [1] => Dynarray (refcnt=1)
                (
                    [title] => Dynarray (refcnt=1)
                        (
                            [text] => Riverford Farm Cook Book
                            [attributes] => Dynarray (refcnt=1)
                                (
                                    [lang] => en
                                )
                        )
                    [author] => Dynarray (refcnt=1)
                        (
                            [text] => Jane Baxter
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [year] => Dynarray (refcnt=1)
                        (
                            [text] => 2008
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [format] => Dynarray (refcnt=1)
                        (
                            [text] => Paperback
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [attributes] => Dynarray (refcnt=1)
                        (
                            [category] => COOKING
                        )
                )
        )
)
 
Dynarray (refcnt=0)
(
    [book] => Dynarray (refcnt=1)
        (
            [1] => Dynarray (refcnt=1)
                (
                    [title] => Dynarray (refcnt=1)
                        (
                            [text] => The House At Pooh Corner
                            [attributes] => Dynarray (refcnt=1)
                                (
                                    [lang] => en
                                )
                        )
                    [author] => Dynarray (refcnt=1)
                        (
                            [text] => A. A. Milne
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [year] => Dynarray (refcnt=1)
                        (
                            [text] => 1928
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [format] => Dynarray (refcnt=1)
                        (
                            [text] => Hardback
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [attributes] => Dynarray (refcnt=1)
                        (
                            [category] => CHILDREN
                        )
                )
        )
)
 
Dynarray (refcnt=0)
(
    [book] => Dynarray (refcnt=1)
        (
            [1] => Dynarray (refcnt=1)
                (
                    [title] => Dynarray (refcnt=1)
                        (
                            [text] => Knots and Crosses
                            [attributes] => Dynarray (refcnt=1)
                                (
                                    [lang] => en
                                )
                        )
                    [author] => Dynarray (refcnt=1)
                        (
                            [text] => Ian Rankin
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [year] => Dynarray (refcnt=1)
                        (
                            [text] => 2008
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [format] => Dynarray (refcnt=1)
                        (
                            [text] => EPUB
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [attributes] => Dynarray (refcnt=1)
                        (
                            [category] => CRIME
                        )
                )
        )
)
 
Dynarray (refcnt=0)
(
    [book] => Dynarray (refcnt=1)
        (
            [1] => Dynarray (refcnt=1)
                (
                    [title] => Dynarray (refcnt=1)
                        (
                            [text] => Le mythe de Sisyphe
                            [attributes] => Dynarray (refcnt=1)
                                (
                                    [lang] => fr
                                )
                        )
                    [author] => Dynarray (refcnt=1)
                        (
                            [text] => Albert Camus
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [year] => Dynarray (refcnt=1)
                        (
                            [text] => 1943
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [format] => Dynarray (refcnt=1)
                        (
                            [text] => Paperback
                            [attributes] => Dynarray (refcnt=1)
                                (
                                )
                        )
                    [attributes] => Dynarray (refcnt=1)
                        (
                            [category] => PHILOSOPHY
                        )
                )
        )
)