dom
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 174
SVG::DOM 2.33
SVG::DOM is a Perl library of DOM (Document Object Model) methods for SVG objects. more>>
SVG::DOM is a Perl library with DOM (Document Object Model) methods for SVG objects.
SVG::DOM provides a selection of methods for accessing and manipulating SVG elements through DOM-like methods such as getElements, getChildren, getNextSibling and so on.
Currently only methods that provide read operations are supported. Methods to manipulate SVG elements will be added in a future release.
SYNOPSIS
my $svg=new SVG(id=>"svg_dom_synopsis", width=>"100", height=>"100");
my %attributes=$svg->getAttributes;
my $group=$svg->group(id=>"group_1");
my $name=$group->getElementName;
my $id=$group->getElementID;
$group->circle(id=>"circle_1", cx=>20, cy=>20, r=>5, fill=>"red");
my $rect=$group->rect(id=>"rect_1", x=>10, y=>10, width=>20, height=>30);
my $width=$rect->getAttribute("width");
my $has_children=$group->hasChildren();
my @children=$group->getChildren();
my $kid=$group->getFirstChild();
do {
print $kid->xmlify();
} while ($kid=$kid->getNextSibling);
my @ancestors=$rect->getParents();
my $is_ancestor=$group->isAncestor($rect);
my $is_descendant=$rect->isDescendant($svg);
my @rectangles=$svg->getElements("rect");
my $allelements_arrayref=$svg->getElements();
...and so on...
<<lessSVG::DOM provides a selection of methods for accessing and manipulating SVG elements through DOM-like methods such as getElements, getChildren, getNextSibling and so on.
Currently only methods that provide read operations are supported. Methods to manipulate SVG elements will be added in a future release.
SYNOPSIS
my $svg=new SVG(id=>"svg_dom_synopsis", width=>"100", height=>"100");
my %attributes=$svg->getAttributes;
my $group=$svg->group(id=>"group_1");
my $name=$group->getElementName;
my $id=$group->getElementID;
$group->circle(id=>"circle_1", cx=>20, cy=>20, r=>5, fill=>"red");
my $rect=$group->rect(id=>"rect_1", x=>10, y=>10, width=>20, height=>30);
my $width=$rect->getAttribute("width");
my $has_children=$group->hasChildren();
my @children=$group->getChildren();
my $kid=$group->getFirstChild();
do {
print $kid->xmlify();
} while ($kid=$kid->getNextSibling);
my @ancestors=$rect->getParents();
my $is_ancestor=$group->isAncestor($rect);
my $is_descendant=$rect->isDescendant($svg);
my @rectangles=$svg->getElements("rect");
my $allelements_arrayref=$svg->getElements();
...and so on...
Download (0.050MB)
Added: 2007-04-23 License: Perl Artistic License Price:
915 downloads
XML::DOM 1.44
XML::DOM is a perl module for building DOM Level 1 compliant document structures. more>>
XML::DOM is a perl module for building DOM Level 1 compliant document structures.
SYNOPSIS
use XML::DOM;
my $parser = new XML::DOM::Parser;
my $doc = $parser->parsefile ("file.xml");
# print all HREF attributes of all CODEBASE elements
my $nodes = $doc->getElementsByTagName ("CODEBASE");
my $n = $nodes->getLength;
for (my $i = 0; $i < $n; $i++)
{
my $node = $nodes->item ($i);
my $href = $node->getAttributeNode ("HREF");
print $href->getValue . "n";
}
# Print doc file
$doc->printToFile ("out.xml");
# Print to string
print $doc->toString;
# Avoid memory leaks - cleanup circular references for garbage collection
$doc->dispose;
This module extends the XML::Parser module by Clark Cooper. The XML::Parser module is built on top of XML::Parser::Expat, which is a lower level interface to James Clarks expat library.
XML::DOM::Parser is derived from XML::Parser. It parses XML strings or files and builds a data structure that conforms to the API of the Document Object Model as described at http://www.w3.org/TR/REC-DOM-Level-1. See the XML::Parser manpage for other available features of the XML::DOM::Parser class. Note that the Style property should not be used (it is set internally.)
The XML::Parser NoExpand option is more or less supported, in that it will generate EntityReference objects whenever an entity reference is encountered in character data. Im not sure how useful this is. Any comments are welcome.
As described in the synopsis, when you create an XML::DOM::Parser object, the parse and parsefile methods create an XML::DOM::Document object from the specified input. This Document object can then be examined, modified and written back out to a file or converted to a string.
When using XML::DOM with XML::Parser version 2.19 and up, setting the XML::DOM::Parser option KeepCDATA to 1 will store CDATASections in CDATASection nodes, instead of converting them to Text nodes. Subsequent CDATASection nodes will be merged into one. Let me know if this is a problem.
When using XML::Parser 2.27 and above, you can suppress expansion of parameter entity references (e.g. %pent;) in the DTD, by setting ParseParamEnt to 1 and ExpandParamEnt to 0. See Hidden Nodes for details.
A Document has a tree structure consisting of Node objects. A Node may contain other nodes, depending on its type. A Document may have Element, Text, Comment, and CDATASection nodes. Element nodes may have Attr, Element, Text, Comment, and CDATASection nodes. The other nodes may not have any child nodes.
This module adds several node types that are not part of the DOM spec (yet.) These are: ElementDecl (for < !ELEMENT ... > declarations), AttlistDecl (for < !ATTLIST ... > declarations), XMLDecl (for < ?xml ...? > declarations) and AttDef (for attribute definitions in an AttlistDecl.)
<<lessSYNOPSIS
use XML::DOM;
my $parser = new XML::DOM::Parser;
my $doc = $parser->parsefile ("file.xml");
# print all HREF attributes of all CODEBASE elements
my $nodes = $doc->getElementsByTagName ("CODEBASE");
my $n = $nodes->getLength;
for (my $i = 0; $i < $n; $i++)
{
my $node = $nodes->item ($i);
my $href = $node->getAttributeNode ("HREF");
print $href->getValue . "n";
}
# Print doc file
$doc->printToFile ("out.xml");
# Print to string
print $doc->toString;
# Avoid memory leaks - cleanup circular references for garbage collection
$doc->dispose;
This module extends the XML::Parser module by Clark Cooper. The XML::Parser module is built on top of XML::Parser::Expat, which is a lower level interface to James Clarks expat library.
XML::DOM::Parser is derived from XML::Parser. It parses XML strings or files and builds a data structure that conforms to the API of the Document Object Model as described at http://www.w3.org/TR/REC-DOM-Level-1. See the XML::Parser manpage for other available features of the XML::DOM::Parser class. Note that the Style property should not be used (it is set internally.)
The XML::Parser NoExpand option is more or less supported, in that it will generate EntityReference objects whenever an entity reference is encountered in character data. Im not sure how useful this is. Any comments are welcome.
As described in the synopsis, when you create an XML::DOM::Parser object, the parse and parsefile methods create an XML::DOM::Document object from the specified input. This Document object can then be examined, modified and written back out to a file or converted to a string.
When using XML::DOM with XML::Parser version 2.19 and up, setting the XML::DOM::Parser option KeepCDATA to 1 will store CDATASections in CDATASection nodes, instead of converting them to Text nodes. Subsequent CDATASection nodes will be merged into one. Let me know if this is a problem.
When using XML::Parser 2.27 and above, you can suppress expansion of parameter entity references (e.g. %pent;) in the DTD, by setting ParseParamEnt to 1 and ExpandParamEnt to 0. See Hidden Nodes for details.
A Document has a tree structure consisting of Node objects. A Node may contain other nodes, depending on its type. A Document may have Element, Text, Comment, and CDATASection nodes. Element nodes may have Attr, Element, Text, Comment, and CDATASection nodes. The other nodes may not have any child nodes.
This module adds several node types that are not part of the DOM spec (yet.) These are: ElementDecl (for < !ELEMENT ... > declarations), AttlistDecl (for < !ATTLIST ... > declarations), XMLDecl (for < ?xml ...? > declarations) and AttDef (for attribute definitions in an AttlistDecl.)
Download (0.14MB)
Added: 2006-07-14 License: GPL (GNU General Public License) Price:
1200 downloads
DOM3K 0.1.1
DOM3K is a fast and rapid development Framework for AJAX. more>>
DOM3K is a fast and rapid development Framework for AJAX. DOM3K uses SPyRO as Web services provider (with the XMLRPC message format) and supports a set of fast and furious javascript functions to manage and create amazing sites.
DOM3K can create standalone applications with the web server included in SPyRO or can be used with monarca web server to get pyew pages support. Support for the Apache Web server is provided too, with all advantages of an Enterprise level Web Server.
Components of dom3k
- dom3k: The HTML DOM Manager.
- db3k: A DB connection object, a wrapper to DBApi2.
- easyform.js: The easyform DOM manager.
<<lessDOM3K can create standalone applications with the web server included in SPyRO or can be used with monarca web server to get pyew pages support. Support for the Apache Web server is provided too, with all advantages of an Enterprise level Web Server.
Components of dom3k
- dom3k: The HTML DOM Manager.
- db3k: A DB connection object, a wrapper to DBApi2.
- easyform.js: The easyform DOM manager.
Download (0.058MB)
Added: 2006-10-15 License: GPL (GNU General Public License) Price:
1104 downloads
dom4j 1.6.1
dom4j provides a Java library for working with XML, XPath, and XSLT. more>>
dom4j provides a Java library for working with XML, XPath, and XSLT.
dom4j is an easy to use, open source library for working with XML, XPath, and XSLT on the Java platform, using the Java Collections Framework, and with full support for DOM, SAX, and JAXP.
Main features:
- designed for the Java platform with full support for the Java Collections Framework (Java 2 Collections)
- full support for JAXP, TrAX, SAX, DOM, and XSLT
- fully integrated XPath support for easy navigation of XML documents
- event based proccessing mode to support for massive documents or XML streams
- based on Java interfaces for flexible plug and play implementations.
- support for XML Schema Data Type support using Kohsuke Kawaguchis excellent Multi Schema Validator library
Enhancements:
- Updated the XPP2 implementation to version 2.1.10.
- Fixed a problem with XMLWriterthat was causing too many new lines to be written to the resulting XML.
- Include more information about the cause if an XPathExceptionor InvalidXPathExceptionis thrown.
<<lessdom4j is an easy to use, open source library for working with XML, XPath, and XSLT on the Java platform, using the Java Collections Framework, and with full support for DOM, SAX, and JAXP.
Main features:
- designed for the Java platform with full support for the Java Collections Framework (Java 2 Collections)
- full support for JAXP, TrAX, SAX, DOM, and XSLT
- fully integrated XPath support for easy navigation of XML documents
- event based proccessing mode to support for massive documents or XML streams
- based on Java interfaces for flexible plug and play implementations.
- support for XML Schema Data Type support using Kohsuke Kawaguchis excellent Multi Schema Validator library
Enhancements:
- Updated the XPP2 implementation to version 2.1.10.
- Fixed a problem with XMLWriterthat was causing too many new lines to be written to the resulting XML.
- Include more information about the cause if an XPathExceptionor InvalidXPathExceptionis thrown.
Download (0.31MB)
Added: 2007-03-05 License: BSD License Price:
973 downloads
DOM Menu 0.3.2
DOM Menu is a hierarchical JavaScript popup menus. more>>
DOM Menu allows developers to add dynamic, hierarchical popup menus on their web pages. The direction of the menu can either be horizontal or vertical and the menu can open (or popout) in either direction. It has both screen edge detection and < select > element detection (for browsers that cannot hide these form elements).
The styles for the menu items are contr olled almost entirely through CSS and the menus are created/hidden using the DOM (Document Object M odel).
Menu configuration is done using a custom Hash() class and is very portable from a PHP type array structure. The menus attempt to follow the look and feel of well known GUI toolkit menus.
Version restrictions:
- cannot use opposite direction to open
- opera 7 having difficulty with table (need to work around)
Enhancements:
- added support for IE 5.0
- fixed problem when submenu was deactivated and parent would highlight
- added a converter from phplayersmenu
<<lessThe styles for the menu items are contr olled almost entirely through CSS and the menus are created/hidden using the DOM (Document Object M odel).
Menu configuration is done using a custom Hash() class and is very portable from a PHP type array structure. The menus attempt to follow the look and feel of well known GUI toolkit menus.
Version restrictions:
- cannot use opposite direction to open
- opera 7 having difficulty with table (need to work around)
Enhancements:
- added support for IE 5.0
- fixed problem when submenu was deactivated and parent would highlight
- added a converter from phplayersmenu
Download (0.045MB)
Added: 2005-05-05 License: LGPL (GNU Lesser General Public License) Price:
1633 downloads
OverDOM 0.1.5
OverDOM is a Java implementation of the W3C DOM, layered over a Web browsers native implementation. more>>
OverDOM is a Java implementation of the W3C DOM, layered over a Web browsers native implementation.
OverDOM provides applets with access to the browsers loaded document, through a familiar Java binding. It aims to support:
- DOM level 3
- XML and HTML
- XML namespaces
- events
- traversal & range
Usage:
import netscape.javascript.JSObject;
import org.w3c.dom.*;
import org.w3c.dom.events.*;
import org.w3c.dom.ranges.*;
import org.w3c.dom.traversal.*;
import textbender.g.hold.SpoolT;
import textbender.o.browser.overdom.*;
- - -
SpoolT spool = new SpoolT();
OverDOM overDOM = new OverDOM( spool );
WindowO window = JSObjectOverlay.getWindow( overDOM, applet );
// DOM level 3
Document document = window.getDocument();
// events
EventTarget eventRegistry = (EventTarget)document;
// traversal
TreeWalker walker = ((DocumentTraversal)document).createTreeWalker( - - - );
// range
Range range = ((DocumentRange)document).createRange();
- - -
spool.unwind(); // release overDOM (when applet destroyed, or earlier)
<<lessOverDOM provides applets with access to the browsers loaded document, through a familiar Java binding. It aims to support:
- DOM level 3
- XML and HTML
- XML namespaces
- events
- traversal & range
Usage:
import netscape.javascript.JSObject;
import org.w3c.dom.*;
import org.w3c.dom.events.*;
import org.w3c.dom.ranges.*;
import org.w3c.dom.traversal.*;
import textbender.g.hold.SpoolT;
import textbender.o.browser.overdom.*;
- - -
SpoolT spool = new SpoolT();
OverDOM overDOM = new OverDOM( spool );
WindowO window = JSObjectOverlay.getWindow( overDOM, applet );
// DOM level 3
Document document = window.getDocument();
// events
EventTarget eventRegistry = (EventTarget)document;
// traversal
TreeWalker walker = ((DocumentTraversal)document).createTreeWalker( - - - );
// range
Range range = ((DocumentRange)document).createRange();
- - -
spool.unwind(); // release overDOM (when applet destroyed, or earlier)
Download (MB)
Added: 2007-01-07 License: MIT/X Consortium License Price:
1021 downloads
XML::DOM2 0.03
XML::DOM2 is a DOM controlled, strict XML module for extentable xml objects. more>>
XML::DOM2 is a DOM controlled, strict XML module for extentable xml objects.
XML::DOM2 is yet _another_ perl XML module.
Main features:
- DOM Level2 Compilence in both document, elements and attributes
- NameSpace control for elements and attributes
- XPath (its just one small method once you have a good DOM)
- Extendability:
- Document, Element or Attribute classes can be used as base class for other kinds of document, element or attribute.
- Element and Attribute Handler allows element specific child elements and attribute objects.
- Element and Attribute serialisation overiding.
- Parsing with SAX (use XML::SAX::PurePerl for low dependancy installs)
- Internal serialisation
<<lessXML::DOM2 is yet _another_ perl XML module.
Main features:
- DOM Level2 Compilence in both document, elements and attributes
- NameSpace control for elements and attributes
- XPath (its just one small method once you have a good DOM)
- Extendability:
- Document, Element or Attribute classes can be used as base class for other kinds of document, element or attribute.
- Element and Attribute Handler allows element specific child elements and attribute objects.
- Element and Attribute serialisation overiding.
- Parsing with SAX (use XML::SAX::PurePerl for low dependancy installs)
- Internal serialisation
Download (0.017MB)
Added: 2006-07-14 License: Perl Artistic License Price:
1199 downloads
XML::DOM::Node 1.44
XML::DOM::Node is a super class of all nodes in XML::DOM. more>>
XML::DOM::Node is a super class of all nodes in XML::DOM.
XML::DOM::Node is the super class of all nodes in an XML::DOM document. This means that all nodes that subclass XML::DOM::Node also inherit all the methods that XML::DOM::Node implements.
GLOBAL VARIABLES
@NodeNames
The variable @XML::DOM::Node::NodeNames maps the node type constants to strings. It is used by XML::DOM::Node::getNodeTypeName.
<<lessXML::DOM::Node is the super class of all nodes in an XML::DOM document. This means that all nodes that subclass XML::DOM::Node also inherit all the methods that XML::DOM::Node implements.
GLOBAL VARIABLES
@NodeNames
The variable @XML::DOM::Node::NodeNames maps the node type constants to strings. It is used by XML::DOM::Node::getNodeTypeName.
Download (0.11MB)
Added: 2006-07-17 License: Perl Artistic License Price:
1194 downloads
XML::DOM::Attr 1.44
XML::DOM::Attr is an XML attribute in XML::DOM. more>>
XML::DOM::Attr is an XML attribute in XML::DOM.
XML::DOM::Attr extends XML::DOM::Node.
The Attr nodes built by the XML::DOM::Parser always have one child node which is a Text node containing the expanded string value (i.e. EntityReferences are always expanded.) EntityReferences may be added when modifying or creating a new Document.
The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a document type definition.
Attr objects inherit the Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the Node attributes parentNode, previousSibling, and nextSibling have a undef value for Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type.
Furthermore, Attr nodes may not be immediate children of a DocumentFragment. However, they can be associated with Element nodes contained within a DocumentFragment. In short, users and implementors of the DOM need to be aware that Attr nodes have some things in common with other objects inheriting the Node interface, but they also are quite distinct.
The attributes effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attributes effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attributes effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the nodeValue attribute on the Attr instance can also be used to retrieve the string version of the attributes value(s).
In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node provide a representation in which entity references are not expanded. These child nodes may be either Text or EntityReference nodes. Because the attribute type may be unknown, there are no tokenized attribute values.
<<lessXML::DOM::Attr extends XML::DOM::Node.
The Attr nodes built by the XML::DOM::Parser always have one child node which is a Text node containing the expanded string value (i.e. EntityReferences are always expanded.) EntityReferences may be added when modifying or creating a new Document.
The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a document type definition.
Attr objects inherit the Node interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the Node attributes parentNode, previousSibling, and nextSibling have a undef value for Attr objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type.
Furthermore, Attr nodes may not be immediate children of a DocumentFragment. However, they can be associated with Element nodes contained within a DocumentFragment. In short, users and implementors of the DOM need to be aware that Attr nodes have some things in common with other objects inheriting the Node interface, but they also are quite distinct.
The attributes effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attributes effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attributes effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the nodeValue attribute on the Attr instance can also be used to retrieve the string version of the attributes value(s).
In XML, where the value of an attribute can contain entity references, the child nodes of the Attr node provide a representation in which entity references are not expanded. These child nodes may be either Text or EntityReference nodes. Because the attribute type may be unknown, there are no tokenized attribute values.
Download (0.11MB)
Added: 2006-07-20 License: GPL (GNU General Public License) Price:
1191 downloads
XML::DOM::Lite 0.10
XML::DOM::Lite is a Lite Pure Perl XML DOM Parser Kit. more>>
XML::DOM::Lite is a Lite Pure Perl XML DOM Parser Kit.
SYNOPSIS
# Parser
use XML::DOM::Lite qw(Parser :constants);
$parser = Parser->new( %options );
$doc = Parser->parse($xmlstr);
$doc = Parser->parseFile(/path/to/file.xml);
# strip whitespace (can be about 30% faster)
$doc = Parser->parse($xml, whitespace => strip);
# All Nodes
$copy = $node->cloneNode($deep);
$nodeType = $node->nodeType;
$parent = $node->parentNode;
$name = $node->nodeName;
$xmlstr = $node->xml;
$owner = $node->ownerDocument;
# Element Nodes
$first = $node->firstChild;
$last = $node->lastChild;
$tag = $node->tagName;
$prev = $node->nextSibling;
$next = $node->previousSibling;
$node->setAttribute("foo", $bar);
$foo = $node->getAttribute("foo");
foreach my $attr (@{$node->attributes}) { # attributes as nodelist
# ... do stuff
}
$node->attributes->{foo} = "bar"; # or as hashref (overload)
$liveNodeList = $node->getElementsByTagName("child"); # deep
$node->insertBefore($newchild, $refchild);
$node->replaceChild($newchild, $refchild);
# Text Nodes
$nodeValue = $node->nodeValue;
$node->nodeValue("new text value");
# Processing Instruction Nodes
# CDATA Nodes
# Comments
$data = $node->nodeValue;
# NodeList
$item = $nodeList->item(42);
$index = $nodeList->nodeIndex($node);
$nlist->insertNode($newNode, $index);
$removed = $nlist->removeNode($node);
$length = $nlist->length; # OR scalar(@$nodeList)
# NodeIterator and NodeFilter
use XML::DOM::Lite qw(NodeIterator :constants);
$niter = NodeIterator->new($rootnode, SHOW_ELEMENT, {
acceptNode => sub {
my $n = shift;
if ($n->tagName eq wantme) {
return FILTER_ACCEPT;
} elsif ($n->tagName eq skipme) {
return FILTER_SKIP;
} else {
return FILTER_REJECT;
}
}
);
while (my $n = $niter->nextNode) {
# do stuff
}
# XSLT
use XML::DOM::Lite qw(Parser XSLT);
$parser = Parser->new( whitespace => strip );
$xsldoc = $parser->parse($xsl);
$xmldoc = $parser->parse($xml);
$output = XSLT->process($xmldoc, $xsldoc);
# XPath
use XML::DOM::Lite qw(XPath);
$result = XPath->evaluate(/path/to/*[@attr="value"], $contextNode);
# Document
$rootnode = $doc->documentElement;
$nodeWithId = $doc->getElementById("my_node_id");
$textnode = $doc->createTextNode("some text string");
$element = $doc->createElement("myTagName");
$docfrag = $doc->createDocumentFragment();
$xmlstr = $doc->xml;
$nlist = $doc->selectNodes(/xpath/expression);
$node = $doc->selectSingleNode(/xpath/expression);
# Serializer
use XML::DOM::Lite qw(Serializer);
$serializer = Serializer->new;
$xmlout = $serializer->serializeToString($node);
<<lessSYNOPSIS
# Parser
use XML::DOM::Lite qw(Parser :constants);
$parser = Parser->new( %options );
$doc = Parser->parse($xmlstr);
$doc = Parser->parseFile(/path/to/file.xml);
# strip whitespace (can be about 30% faster)
$doc = Parser->parse($xml, whitespace => strip);
# All Nodes
$copy = $node->cloneNode($deep);
$nodeType = $node->nodeType;
$parent = $node->parentNode;
$name = $node->nodeName;
$xmlstr = $node->xml;
$owner = $node->ownerDocument;
# Element Nodes
$first = $node->firstChild;
$last = $node->lastChild;
$tag = $node->tagName;
$prev = $node->nextSibling;
$next = $node->previousSibling;
$node->setAttribute("foo", $bar);
$foo = $node->getAttribute("foo");
foreach my $attr (@{$node->attributes}) { # attributes as nodelist
# ... do stuff
}
$node->attributes->{foo} = "bar"; # or as hashref (overload)
$liveNodeList = $node->getElementsByTagName("child"); # deep
$node->insertBefore($newchild, $refchild);
$node->replaceChild($newchild, $refchild);
# Text Nodes
$nodeValue = $node->nodeValue;
$node->nodeValue("new text value");
# Processing Instruction Nodes
# CDATA Nodes
# Comments
$data = $node->nodeValue;
# NodeList
$item = $nodeList->item(42);
$index = $nodeList->nodeIndex($node);
$nlist->insertNode($newNode, $index);
$removed = $nlist->removeNode($node);
$length = $nlist->length; # OR scalar(@$nodeList)
# NodeIterator and NodeFilter
use XML::DOM::Lite qw(NodeIterator :constants);
$niter = NodeIterator->new($rootnode, SHOW_ELEMENT, {
acceptNode => sub {
my $n = shift;
if ($n->tagName eq wantme) {
return FILTER_ACCEPT;
} elsif ($n->tagName eq skipme) {
return FILTER_SKIP;
} else {
return FILTER_REJECT;
}
}
);
while (my $n = $niter->nextNode) {
# do stuff
}
# XSLT
use XML::DOM::Lite qw(Parser XSLT);
$parser = Parser->new( whitespace => strip );
$xsldoc = $parser->parse($xsl);
$xmldoc = $parser->parse($xml);
$output = XSLT->process($xmldoc, $xsldoc);
# XPath
use XML::DOM::Lite qw(XPath);
$result = XPath->evaluate(/path/to/*[@attr="value"], $contextNode);
# Document
$rootnode = $doc->documentElement;
$nodeWithId = $doc->getElementById("my_node_id");
$textnode = $doc->createTextNode("some text string");
$element = $doc->createElement("myTagName");
$docfrag = $doc->createDocumentFragment();
$xmlstr = $doc->xml;
$nlist = $doc->selectNodes(/xpath/expression);
$node = $doc->selectSingleNode(/xpath/expression);
# Serializer
use XML::DOM::Lite qw(Serializer);
$serializer = Serializer->new;
$xmlout = $serializer->serializeToString($node);
Download (0.030MB)
Added: 2006-07-14 License: Perl Artistic License Price:
1199 downloads
XML::DOM::Text 1.44
XML::DOM::Text is a piece of XML text in XML::DOM. more>>
XML::DOM::Text is a piece of XML text in XML::DOM.
XML::DOM::Text extends XML::DOM::CharacterData, which extends XML::DOM::Node.
The Text interface represents the textual content (termed character data in XML) of an Element or Attr. If there is no markup inside an elements content, the text is contained in a single object implementing the Text interface that is the only child of the element. If there is markup, it is parsed into a list of elements and Text nodes that form the list of children of the element.
When a document is first made available via the DOM, there is only one Text node for each block of text. Users may create adjacent Text nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The normalize() method on Element merges any such adjacent Text objects into a single node for each block of text; this is recommended before employing operations that depend on a particular document structure, such as navigation with XPointers.
METHODS
splitText (offset)
Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to the offset point. And a new Text node, which is inserted as the next sibling of this node, contains all the content at and after the offset point.
Parameters: offset The offset at which to split, starting from 0.
Return Value: The new Text node.
DOMExceptions:
INDEX_SIZE_ERR
Raised if the specified offset is negative or greater than the number of characters in data.
NO_MODIFICATION_ALLOWED_ERR
Raised if this node is readonly.
<<lessXML::DOM::Text extends XML::DOM::CharacterData, which extends XML::DOM::Node.
The Text interface represents the textual content (termed character data in XML) of an Element or Attr. If there is no markup inside an elements content, the text is contained in a single object implementing the Text interface that is the only child of the element. If there is markup, it is parsed into a list of elements and Text nodes that form the list of children of the element.
When a document is first made available via the DOM, there is only one Text node for each block of text. Users may create adjacent Text nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The normalize() method on Element merges any such adjacent Text objects into a single node for each block of text; this is recommended before employing operations that depend on a particular document structure, such as navigation with XPointers.
METHODS
splitText (offset)
Breaks this Text node into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to the offset point. And a new Text node, which is inserted as the next sibling of this node, contains all the content at and after the offset point.
Parameters: offset The offset at which to split, starting from 0.
Return Value: The new Text node.
DOMExceptions:
INDEX_SIZE_ERR
Raised if the specified offset is negative or greater than the number of characters in data.
NO_MODIFICATION_ALLOWED_ERR
Raised if this node is readonly.
Download (0.11MB)
Added: 2006-07-20 License: GPL (GNU General Public License) Price:
1191 downloads
XML::DOM::XMLDecl 1.44
XML::DOM::XMLDecl is a XML declaration in XML::DOM. more>>
XML::DOM::XMLDecl is a XML declaration in XML::DOM.
XML::DOM::XMLDecl extends XML::DOM::Node, but is not part of the DOM Level 1 specification.
It contains the XML declaration, e.g.
< ?xml version="1.0" encoding="UTF-16" standalone="yes"? >
See also XML::DOM::Document::getXMLDecl.
METHODS
getVersion and setVersion (version)
Returns and sets the XML version. At the time of this writing the version should always be "1.0"
getEncoding and setEncoding (encoding)
undef may be specified for the encoding value.
getStandalone and setStandalone (standalone)
undef may be specified for the standalone value.
<<lessXML::DOM::XMLDecl extends XML::DOM::Node, but is not part of the DOM Level 1 specification.
It contains the XML declaration, e.g.
< ?xml version="1.0" encoding="UTF-16" standalone="yes"? >
See also XML::DOM::Document::getXMLDecl.
METHODS
getVersion and setVersion (version)
Returns and sets the XML version. At the time of this writing the version should always be "1.0"
getEncoding and setEncoding (encoding)
undef may be specified for the encoding value.
getStandalone and setStandalone (standalone)
undef may be specified for the standalone value.
Download (0.11MB)
Added: 2006-07-20 License: Perl Artistic License Price:
1191 downloads
XML::LibXML::DOM 1.58
XML::LibXML::DOM is a XML::LibXML DOM Implementation. more>>
XML::LibXML::DOM is a XML::LibXML DOM Implementation.
XML::LibXML provides an lightwight interface to modify a node of the document tree generated by the XML::LibXML parser. This interface follows as far as possible the DOM Level 3 specification. Additionally to the specified functions the XML::LibXML supports some functions that are more handy to use in the perl environment.
One also has to remember, that XML::LibXML is an interface to libxml2 nodes which actually reside on the C-Level of XML::LibXML. This means each node is a reference to a structure different than a perl hash or array. The only way to access these structures values is through the DOM interface provided by XML::LibXML. This also means, that one cant simply inherit a XML::LibXML node and add new member variables as they were hash keys.
The DOM interface of XML::LibXML does not intend to implement a full DOM interface as it is done by XML::GDOME and used for full featured application. Moreover, it offers an simple way to build or modify documents that are created by XML::LibXMLs parser.
Another target of the XML::LibXML interface is to make the interfaces of libxml2 available to the perl community. This includes also some workarounds to some features where libxml2 assumes more control over the C-Level that most perl users dont have.
One of the most important parts of the XML::LibXML DOM interface is, that the interfaces try do follow the DOM Level 3 specification rather strictly. This means the interface functions are named as the DOM specification says and not what widespread Java interfaces claim to be standard. Although there are several functions that have only a singular interface that conforms to the DOM spec XML::LibXML provides an additional Java style alias interface.
Also there are some function interfaces left over from early stages of XML::LibXML for compatibility reasons. These interfaces are for compatibility reasons only. They might disappear in one of the future versions of XML::LibXML, so a user is requested to switch over to the official functions.
More recent versions of perl (e.g. 5.6.1 or higher) support special flags to disinguish between UTF8 and so called binary data. XML::LibXML provides for these versions functionality to make efficient use of these flags: If a document has set an encoding other than UTF8 all strings that are not already in UTF8 are implicitly encoded from the document encoding to UTF8. On output these strings are commonly returned as UTF8 unless a user does request explicitly the original (aka. document) encoding.
Older version of perl (such as 5.00503 or less) do not support these flags. If XML::LibXML is build for these versions, all strings have to get encoded to UTF8 manualy before they are passed to any DOM functions.
NOTE: XML::LibXMLs magic encoding may not work on all plattforms. Some platforms are known to have a broken iconv(), which is partly used by libxml2. To test if your platform works correctly with your language encoding, build a simple document in the particular encoding and try to parse it with XML::LibXML. If your document gets parsed with out causing any segmentation faults, bus errors or whatever your OS throws. An example for such a test can be found in test 19encoding.t of the distribution.
Namespaces and XML::LibXMLs DOM implementation
XML::LibXMLs DOM implementation follows the DOM implementation of libxml2. This is important to know if namespaces are used. Namespaces cannot be declared on an document node. This is basicly because XPath doesnt know about document nodes. Therefore namespaces have to be declared on element nodes.
This can happen explicitly by using XML::LibXML:Elements setNamespace() function or more or less implicitly by using XML::LibXML::Documents createElementNS() or createAttributeNS() function. If the a namespace is not declared on the documentElement, the namespace will be localy declared for the newly created node. In case of Attributes this may look a bit confusing, since these nodes cannot have namespace declarations itself. In this case the namespace in internally applied to the attribute and later declared on the node the attribute is appended to.
<<lessXML::LibXML provides an lightwight interface to modify a node of the document tree generated by the XML::LibXML parser. This interface follows as far as possible the DOM Level 3 specification. Additionally to the specified functions the XML::LibXML supports some functions that are more handy to use in the perl environment.
One also has to remember, that XML::LibXML is an interface to libxml2 nodes which actually reside on the C-Level of XML::LibXML. This means each node is a reference to a structure different than a perl hash or array. The only way to access these structures values is through the DOM interface provided by XML::LibXML. This also means, that one cant simply inherit a XML::LibXML node and add new member variables as they were hash keys.
The DOM interface of XML::LibXML does not intend to implement a full DOM interface as it is done by XML::GDOME and used for full featured application. Moreover, it offers an simple way to build or modify documents that are created by XML::LibXMLs parser.
Another target of the XML::LibXML interface is to make the interfaces of libxml2 available to the perl community. This includes also some workarounds to some features where libxml2 assumes more control over the C-Level that most perl users dont have.
One of the most important parts of the XML::LibXML DOM interface is, that the interfaces try do follow the DOM Level 3 specification rather strictly. This means the interface functions are named as the DOM specification says and not what widespread Java interfaces claim to be standard. Although there are several functions that have only a singular interface that conforms to the DOM spec XML::LibXML provides an additional Java style alias interface.
Also there are some function interfaces left over from early stages of XML::LibXML for compatibility reasons. These interfaces are for compatibility reasons only. They might disappear in one of the future versions of XML::LibXML, so a user is requested to switch over to the official functions.
More recent versions of perl (e.g. 5.6.1 or higher) support special flags to disinguish between UTF8 and so called binary data. XML::LibXML provides for these versions functionality to make efficient use of these flags: If a document has set an encoding other than UTF8 all strings that are not already in UTF8 are implicitly encoded from the document encoding to UTF8. On output these strings are commonly returned as UTF8 unless a user does request explicitly the original (aka. document) encoding.
Older version of perl (such as 5.00503 or less) do not support these flags. If XML::LibXML is build for these versions, all strings have to get encoded to UTF8 manualy before they are passed to any DOM functions.
NOTE: XML::LibXMLs magic encoding may not work on all plattforms. Some platforms are known to have a broken iconv(), which is partly used by libxml2. To test if your platform works correctly with your language encoding, build a simple document in the particular encoding and try to parse it with XML::LibXML. If your document gets parsed with out causing any segmentation faults, bus errors or whatever your OS throws. An example for such a test can be found in test 19encoding.t of the distribution.
Namespaces and XML::LibXMLs DOM implementation
XML::LibXMLs DOM implementation follows the DOM implementation of libxml2. This is important to know if namespaces are used. Namespaces cannot be declared on an document node. This is basicly because XPath doesnt know about document nodes. Therefore namespaces have to be declared on element nodes.
This can happen explicitly by using XML::LibXML:Elements setNamespace() function or more or less implicitly by using XML::LibXML::Documents createElementNS() or createAttributeNS() function. If the a namespace is not declared on the documentElement, the namespace will be localy declared for the newly created node. In case of Attributes this may look a bit confusing, since these nodes cannot have namespace declarations itself. In this case the namespace in internally applied to the attribute and later declared on the node the attribute is appended to.
Download (0.16MB)
Added: 2006-07-17 License: GPL (GNU General Public License) Price:
1198 downloads
XML::DOM::XML_Base 0.02
XML::DOM::XML_Base Perl module can apply xml:base to attribute values. more>>
XML::DOM::XML_Base Perl module can apply xml:base to attribute values.
SYNOPSIS
use XML::DOM::XML_Base;
my $parser = XML::DOM::Parser->new();
my $xml = qq(
);
# build the DOM
my $dom = $parser->parse( $xml );
# get some elements
my $endo = $dom->getElementsByTagName( endo )->item( 0 );
my $meso = $dom->getElementsByTagName( meso )->item( 0 );
my $ecto = $dom->getElementsByTagName( ecto )->item( 0 );
print $endo->getBase()."n"; # a/b/c/
print $meso->getBase()."n"; # a/b/
print $ecto->getBase()."n"; # a/
print $endo->getAttributeWithBase( x )."n"; # a/b/c/3
print $meso->getAttributeWithBase( x )."n"; # a/b/2
print $ecto->getAttributeWithBase( x )."n"; # a/1
<<lessSYNOPSIS
use XML::DOM::XML_Base;
my $parser = XML::DOM::Parser->new();
my $xml = qq(
);
# build the DOM
my $dom = $parser->parse( $xml );
# get some elements
my $endo = $dom->getElementsByTagName( endo )->item( 0 );
my $meso = $dom->getElementsByTagName( meso )->item( 0 );
my $ecto = $dom->getElementsByTagName( ecto )->item( 0 );
print $endo->getBase()."n"; # a/b/c/
print $meso->getBase()."n"; # a/b/
print $ecto->getBase()."n"; # a/
print $endo->getAttributeWithBase( x )."n"; # a/b/c/3
print $meso->getAttributeWithBase( x )."n"; # a/b/2
print $ecto->getAttributeWithBase( x )."n"; # a/1
Download (0.003MB)
Added: 2007-07-20 License: Perl Artistic License Price:
826 downloads
XML::Sablotron::DOM 1.01
XML::Sablotron::DOM is the DOM interface to Sablotrons internal structures. more>>
XML::Sablotron::DOM is the DOM interface to Sablotrons internal structures.
SYNOPSIS
use XML::Sablotron::DOM;
my $situa = new XML::Sablotron::Situation();
my $doc = new XML::Sablotron::DOM::Document(SITUATION => $sit);
my $e = $doc->createElement($situa, "foo");
my $t = $doc->createTextNode($situa, "this is my text");
print $doc->toString();
Sablotron uses internally the DOM-like data structures to represent parsed XML trees. In the sdom.h header file is defined a subset of functions allowing the DOM access to these structures.
<<lessSYNOPSIS
use XML::Sablotron::DOM;
my $situa = new XML::Sablotron::Situation();
my $doc = new XML::Sablotron::DOM::Document(SITUATION => $sit);
my $e = $doc->createElement($situa, "foo");
my $t = $doc->createTextNode($situa, "this is my text");
print $doc->toString();
Sablotron uses internally the DOM-like data structures to represent parsed XML trees. In the sdom.h header file is defined a subset of functions allowing the DOM access to these structures.
Download (0.052MB)
Added: 2006-07-14 License: GPL (GNU General Public License) Price:
1198 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above dom search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed