xmlTreeDumpNode

SYNOPSIS

string xmlTreeDumpNode(xmlNode node [, string options])

Parameters:

  • node - the node to dump

  • options - content options (see below)

Returns:

  • the XML contents of node


DESCRIPTION
xmlTreeDumpNode() gives the raw XML content of node. This includes the element itself, its attributes, and all of its element and text children.

This differs from other functions like xmlTreeGetContent in that it includes the XML markup, which may be desirable depending on your needs. See the example for comparisons.

options can be a comma-separated list of:

  • INDENT - add extra whitespace text nodes to indent the output.

  • INNER - if specified, will not include the element itself, only children text and elements (see example below).


EXAMPLE

<capture>
<data>
  <quote>some <b class="query">test</b> content</quote>
</data>
</capture><$xml=$ret>
<$doc = (xmlTreeNewDocFromString($xml))>
<$root = (xmlTreeGetRootElement($doc))>
<$quote = (xmlTreeGetChildren($root, 'quote'))>

<$ret = (xmlTreeGetContent($quote))>
<fmt "xmlTreeGetContent:\n%s\n" $ret>
<$ret = (xmlTreeGetAllContent($quote))>
<fmt "xmlTreeGetAllContent:\n%s\n" $ret>
<$ret = (xmlTreeDumpNode($quote))>
<fmt "xmlTreeDumpNode:\n%s\n" $ret>
<$ret = (xmlTreeDumpNode($quote, 'INNER'))>
<fmt "xmlTreeDumpNode inner:\n%s\n" $ret>

Produces

xmlTreeGetContent:
some  content
xmlTreeGetAllContent:
some test content
xmlTreeDumpNode:
<quote>some <b class="query">test</b> content</quote>
xmlTreeDumpNode inner:
some <b class="query">test</b> content


SEE ALSO
xmlTreeGetName, xmlTreeGetAllContent, xmlTreeGetChildrenContent, xmlTreeGetLine, xmlTreeGetType, xmlTreeIsBlankNode, xmlTreeGetAttributeContent


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.