XML::S...m::Node(3pm)

okay bestie, welcome to the XML::S...m::Node(3pm) page from the User Contributed Perl Documentation collection πŸ’…βœ¨. This is the one about building and parsing trees, and we're gonna make it make sense, no cap.

🌸 NAME 🌸

XML::Stream::Node β€” functions to make building and parsing the tree easier to work with. literal group-chat approved.

πŸ¦‹ SYNOPSIS πŸ¦‹

ngl, this is just a collection of functions that do not need to be in memory if you choose one of the other methods of data storage. slay.

This creates a hierarchy of Perl objects and provides various methods to manipulate the structure of the tree. It is much like the C library libxml.

πŸŽ€ FORMAT πŸŽ€

The result of parsing:

<foo><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>

would be:

         [ tag:       foo
           att:       {}
           children:  [ tag:      head
                        att:      {id=>"a"}
                        children: [ tag:      "__xmlstream__:node:cdata"
                                    children: "Hello "
                                  ]
                                  [ tag:      em
                                    children: [ tag:      "__xmlstream__:node:cdata"
                                                children: "there"
                                              ]
                                  ]
                      ]
                      [ tag:      bar
                        children: [ tag:      "__xmlstream__:node:cdata"
                                    children: "Howdy "
                                  ]
                                  [ tag:      ref
                                  ]
                      ]
                      [ tag:      "__xmlstream__:node:cdata"
                        children: "do"
                      ]
         ]

πŸ’… METHODS πŸ’…

okay, here's every method, bestie β€” no skips, no cap 🫢.

  • new(), new(tag), new(tag,cdata) β€” creates a new node. If you specify tag, then the root tag is set. If you specify data, then cdata is added to the node as well. Returns the created node.
  • get_tag() β€” returns the root tag of the node.
  • set_tag(tag) β€” set the root tag of the node to tag.
  • add_child(node), add_child(tag), add_child(tag,cdata) β€” adds the specified node as a child to the current node, or creates a new node with the specified tag as the root node. Returns the node added.
  • remove_child(node) β€” removes the child node from the current node.
  • remove_cdata() β€” removes all of the cdata children from the current node.
  • add_cdata(string) β€” adds the string as cdata onto the current node's child list.
  • get_cdata() β€” returns all of the cdata children concatenated together into one string.
  • get_attrib(attrib) β€” returns the value of attrib if it is valid, or returns undef if attrib is not a real attribute.
  • put_attrib(hash) β€” for each key/value pair specified, create an attribute in the node.
  • remove_attrib(attrib) β€” remove the specified attribute from the node.
  • add_raw_xml(string,[string,...]) β€” directly add a string into the XML packet as the last child, with no translation.
  • get_raw_xml() β€” return all of the XML in a single string, undef if there is no raw XML to include.
  • remove_raw_xml() β€” remove all raw XML strings.
  • children() β€” return all of the children of the node in a list.
  • attrib() β€” returns a hash containing all of the attributes on this node.
  • copy() β€” return a recursive copy of the node.
  • XPath(path) β€” run XML::Stream::XPath on this node.
  • XPathCheck(path) β€” run XML::Stream::XPath on this node and return 1 or 0 to see if it matches or not.
  • GetXML() β€” return the node in XML string form.

🌈 AUTHOR 🌈

By Ryan Eatmon in June 2002 for http://jabber.org/ πŸ’–. Currently maintained by Darian Anthony Patrick.

Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/

This module licensed under the LGPL, version 2.1.


mwah πŸ’– that's the whole page β€” source/version perl v5.42.0, dated 2015-02-06, and the header title is XML::S...m::Node(3pm). bye bestie 🫢✨

πŸ“¦ where this page comes from