manakai

NAME

Message::Markup::SuikaWikiConfig20::Node: manakai --- SuikaWikiConfig/2.0 data object and serialization

DESCRIPTION

This module provides modeled object tree handling for SuikaWikiConfig/2.0 data format. It also provides a mean of serializing object data tree in SuikaWikiConfig/2.0 format.

Note that to parse plain SuikaWikiConfig/2.0 data and compose object tree for it, Message::Markup::SuikaWikiConfig20::Parser can be used.

This module is part of manakai.

METHODS

$x = Message::Markup::SuikaWikiConfig20::Node->new (%options)

Returns new instance of the module. It is itself a node.

$x->append_node ($node)

Appending given node to the object (as the last child). If the type of given node is #fragment, its all children, not the node itself, are appended.

This method returns the appended node unless the type of given node is #fragment. In such cases, this node ($x) is returned.

Available options: node_or_text.

$new_node = $x->append_new_node (%options)

Appending a new node. The new node is returned.

$new_node = $x->append_text ($text)

Appending given text as a new text node. The new text node is returned.

$attr_node = $x->get_attribute ($local_name, %options)

Returns the attribute node whose local-name is $local_name.

$attr_val = $x->get_attribute_value ($local_name)

Returnes the attribute value whose attribute name is $local_name.

$attr_node = $x->set_attribute ($local_name => $value, %options)

Set the value of the attribute. The attribute node is returned.

$x->remove_attribute ($local_name, %options)

Removes an attribute node.

\@children = $x->child_nodes

Returns an array reference to child nodes.

$local_name = $x->local_name ([$new_name])

Returns or set the local-name.

$type = $x->node_type

Returns the node type.

$node = $x->parent_node

Returns the parent node. If there is no parent node, undef is returned.

$i = $x->count

Returns the number of child nodes.

$tag = $x->inner_text

Returns the text content of the node. (In many case the returned value is same as WinIE DOM inner_text () function's or XPath text() function's. But some classes that inherits this module might implement to return other value (eg. to return the value of the alt attribute of html:img element).

$node->node_path (key => attr-name)

Represent position in the tree in informal XPath-like expression.

Note: In current implementation, the format of expressions is insufficient to identify a node uniquely and it is not XPath compatible.

Options:

key => ( attr-name | [attr-name1, attr-name2, ...] )

An attribute name or an array reference of attribute names that are used as 'key's.

NODE TYPES

This module uses three types of node.

#comment

Comment. Only #document (root) node and #fragment node in well-formed tree can contain this type of node as children.

Comment has a value, but no child.

#document

Document. This type of node must be the root node.

Document can have any number of #element and #comment, in any order, but no value.

#element

Element.

Element can have any number of children. Children must also be #element's. Element has a value, which can be undef (that is different from empty) in case the element has one or more children (cannot be undef if it does not have child).

A value is either a scalar or a list. List is represented as a reference to an array in this module. Note that list with some multiple-line strings cannot be serialized, since SuikaWikiConfig/2.0 text format does not allow it.

#fragment

Fragment of nodes. It's similar to DOM's fragment node.

SEE ALSO

Message::Markup::SuikaWikiConfig20::Parser: Perl module that parses SuikaWikiConfig/2.0 text format document and constructs Message::Markup::SuikaWikiConfig20::Node tree instance.

SuikaWikiConfig/2.0 <https://suika.suikawiki.org/~wakaba/-temp/wiki/wiki?SuikaWikiConfig/2.0>: Formal specification and informal descriptions of the SuikaWikiConfig/2.0 format.

Latest version of this module is available at the manakai CVS repository <https://suika.suikawiki.org/gate/cvs/messaging/manakai/lib/Message/Markup/SuikaWikiConfig20/Parser.pm>.

HISTORY

SuikaWikiConfig/2.0 format was originally defined for SuikaWiki <https://suika.suikawiki.org/~wakaba/-temp/wiki?SuikaWiki>.

This module, formally known as SuikaWiki::Markup::SuikaWikiConfig20, was part of SuikaWiki distribution.

LICENSE

Copyright 2003-2004 Wakaba <wakaba@suikawiki.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.