Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 1.3, prepared

  MODULE Public
Modules
Parser

  MODULE Public.Parser
Modules
XML2

  MODULE Public.Parser.XML2
Classes
Constants
Node

Methods
new_xml()
parse_xml()
render_xml()
select_xpath_nodes()
substituteEntitiesDefault()
utf8_check()
utf8_to_html()
utf8_to_isolat1()

Method select_xpath_nodes

array(object(Node)) Public.Parser.XML2.select_xpath_nodes(string xpath, object node)

Description

selects nodes based on an XPath query and returns the result.


Method substituteEntitiesDefault

int Public.Parser.XML2.substituteEntitiesDefault(int def)


Method utf8_to_html

string Public.Parser.XML2.utf8_to_html(string str)


Method utf8_to_isolat1

string Public.Parser.XML2.utf8_to_isolat1(string str)


Method utf8_check

int Public.Parser.XML2.utf8_check(string str)


Method render_xml

string Public.Parser.XML2.render_xml(object(Node) n)

Description

Renders a node tree as an XML string. The entire document tree will be rendered. To render a portion of a tree, use Node.render_xml.

Parameter n

a Node object for a given XML document.


Method parse_xml

object(Node) Public.Parser.XML2.parse_xml(string xml)

Description

Parse an string containing XML.

Returns

a Node object containing the root of the tree.


Method new_xml

object(Node) Public.Parser.XML2.new_xml(string version)

Description

Create a new XML document with a root node.

Parameter version

the version of XML to create

Parameter root_name

the name of the root node

Returns

a Node object containing the root of the tree.

  CLASS Public.Parser.XML2.Node
Methods
()
add_child()
add_next_sibling()
add_ns()
add_prev_sibling()
add_sibling()
children()
delete_attribute()
get_attributes()
get_base()
get_lang()
get_last_child()
get_line_no()
get_no_ns_attributes()
get_node_path()
get_node_type()
get_ns()
get_ns_attributes()
get_nss()
get_root_node()
get_space_preserve()
get_text()
is_blank()
is_text()
new_cdata_block()
new_char_ref()
new_child()
new_comment()
new_pi()
next()
parent()
prev()
render_xml()
set_content()
set_node_name()
set_ns()
set_root_node()

Method get_line_no

int Public.Parser.XML2.Node()->get_line_no()

Returns

the line number the node is present on


Method set_ns

object(Node) Public.Parser.XML2.Node()->set_ns(string ns_prefix)


Method set_content

object(Node) Public.Parser.XML2.Node()->set_content(string content)

Description

sets the content for a node


Method get_text

string Public.Parser.XML2.Node()->get_text()

Description

gets the contents of a text node, or the contents and children of an element, or the value of an attribute node.


Method get_node_path

string Public.Parser.XML2.Node()->get_node_path()

Description

returns an XPath/XQuery based path for this Node.


Method get_ns

string Public.Parser.XML2.Node()->get_ns()

Description

returns the default name space uri for the element


Method get_nss

mapping Public.Parser.XML2.Node()->get_nss()

Description

gets a list of all known namespaces for this element.

Returns

a mapping of "short" prefixes to namespace uris.


Method get_base

string Public.Parser.XML2.Node()->get_base()


Method get_lang

string Public.Parser.XML2.Node()->get_lang()


Method get_space_preserve

int Public.Parser.XML2.Node()->get_space_preserve()


Method get_attributes

mapping Public.Parser.XML2.Node()->get_attributes()

Description

returns all attributes, irrespective of namespace

Returns

a mapping of attribute name to attribute value.


Method get_no_ns_attributes

mapping Public.Parser.XML2.Node()->get_no_ns_attributes()

Description

returns all attributes not present in a namespace

Returns

a mapping of attribute name to attribute value.


Method get_ns_attributes

mapping Public.Parser.XML2.Node()->get_ns_attributes(string ns_prefix)

Description

given a namespace uri, return all elements for that namespace present in the element.

Returns

a mapping of attribute names to attribute values.


Method children

array Public.Parser.XML2.Node()->children()

Description

get all children of this node

Returns

an array of all elements with are a direct child of this element.


Method parent

object(Node) Public.Parser.XML2.Node()->parent()

Description

get the Node which is the parent of this Node.


Method get_root_node

object(Node) Public.Parser.XML2.Node()->get_root_node()

Description

get the Node which is the root of this tree.


Method set_root_node

object(Node) Public.Parser.XML2.Node()->set_root_node()

Description

set this Node to be the root of this tree.

Returns

the old root of the tree, if any existed.


Method new_cdata_block

object(Node) Public.Parser.XML2.Node()->new_cdata_block(string contents)

Description

returns an unlinked CDATA block.


Method new_pi

object(Node) Public.Parser.XML2.Node()->new_pi(string name, string contents)

Description

returns a linked Processing Instruction node.


Methods

object(Node) Public.Parser.XML2.Node()->set_attribute(string name, string value)
object(Node) Public.Parser.XML2.Node()->set_ns_attribute(string name, string ns, string value)

Description

sets a new attribute, overwriting any existing value. if value is zero, the attribute will be removed from the node.


Method delete_attribute

object Public.Parser.XML2.Node()->delete_attribute(string name, string|void ns)


Method new_char_ref

object(Node) Public.Parser.XML2.Node()->new_char_ref(string name)

Description

returns an unlinked character reference node.


Method new_comment

object(Node) Public.Parser.XML2.Node()->new_comment(string content)

Description

returns an unlinked character reference node.


Method new_child

object(Node) Public.Parser.XML2.Node()->new_child(string ns, string name, string content)

Description

add a new child element, added to end of children for this node.


Method add_ns

object(Node) Public.Parser.XML2.Node()->add_ns(string href, string prefix)


Method add_child

object(Node) Public.Parser.XML2.Node()->add_child(object(Node) child)

Description

add a node to end of children for this node.


Method add_sibling

object(Node) Public.Parser.XML2.Node()->add_sibling(object(Node) sibling)

Description

add a node to end of siblings for this node.


Method add_next_sibling

object(Node) Public.Parser.XML2.Node()->add_next_sibling(object(Node) sibling)

Description

add a sibling node after this node.


Method add_prev_sibling

object(Node) Public.Parser.XML2.Node()->add_prev_sibling(object(Node) sibling)

Description

add a sibling node after this node.


Method get_last_child

object(Node) Public.Parser.XML2.Node()->get_last_child()

Description

get the Node which is the last child of this Node.


Method next

object(Node) Public.Parser.XML2.Node()->next()

Description

get the next sibling of this Node.

Returns

the next node which is a sibling of this node.


Method prev

object(Node) Public.Parser.XML2.Node()->prev()

Description

get the previous sibling of this Node.

Returns

the previous node which is a sibling of this node.


Method is_blank

int Public.Parser.XML2.Node()->is_blank()

Description

is this node empty?


Method is_text

int Public.Parser.XML2.Node()->is_text()

Description

is this a text node?


Method get_node_type

int Public.Parser.XML2.Node()->get_node_type()

Description

get the type of node.

Returns

the integer node type. Node type constantes are defined in Constants.

gets the name of this node, if it has one.


Method set_node_name

string Public.Parser.XML2.Node()->set_node_name(string name)

Description

gets the name of this node, if it has one.


Method render_xml

string Public.Parser.XML2.Node()->render_xml(int level, int format)

Description

renders the node and all children as xml.

Parameter level

the indentation level to use

Parameter format

should the xml be formated for ease of human reading. this setting only takes effect if Public.Parser.XML2.xmlKeepBlanksDefault(0) has been called.

  CLASS Public.Parser.XML2.Constants
gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University