C.1 Common Modules

LaTeXML::Common::XML

XML utilities

Description

This module provides utilities for accessing XML, along with some patches to XML::LibXML.

element_nodes($node)

Returns a list of the element children of $node.

text_in_node($node)

Returns the string combining the text nodes within $node.

isTeXtNode($node)

Checks whether $node is a text node.

isElementNode($node)

Checks whether $node is a element node.

isChild($child,$parent)

Checks whether $child is a child of $parent.

isDecscendant($child,$parent)

Checks whether $child is a descendant of $parent.

isDecscendantOrSelf($child,$parent)

Checks whether $child is a descendant of, or the same as, $parent.

new_node($nsURI,$tag,$children,%attributes)

Creates a new element node with tag $tag (in the namespace $nsURI), with the children in the array ref $children (if any) and assigning the given attributes.

append_nodes($node,@children)

Appends the given children to $node.

clear_node($node)

Removes all element and text children from $node.

maybe_clone($node)

Clones $node if it has a parent, otherwise returns it.

copy_attributes($to,$from)

Copy all attributes from $from to $to.

rename_attribute($node,$from,$to)

Rename the attribute $from to $to on the node $node.

remove_attr($node,@attr)

Remove the given attributes from $node.

get_attr($node,@attr)

Returns the list of values for the given attributes on $node

initialize_catalogs()

Initialize XML::LibXML to recognize the catalogs given in LaTeXML.catalogs.

set_RDFa_prefixes($document,$map)

This method scans the document’s RDFa attributes, extracting the prefixes used. These prefixes are then filtered through a $map of known RDFa prefixes and the ones allowed are declared globally for the document via the prefix attribute of its root element.