/^(\.\/|\/|\.\.|\.$)/ Creates a new node.
Creates a new node.
Creates a new node.
Compares with other.
Gets the attribute content for the attribute given by name.
Sets attribute of this node to value.
Gets the attribute content for the attribute given by name.
Returns true if this is an attribute node.
Returns attributes of this node as an XML::Attributes.
Returns true if this is a CDATA section node.
Gets the list of children for this node as a XML::NodeSet.
Returns true if this is a comment node.
Returns the content for this Node.
Sets the Node's content to a Text node containing string.
Deletes attribute given by name.
Gets the document for this Node as a XML::Node.
Returns true if this is a Document or HTML Document node.
Returns true if this is an Element node.
Returns the encoding of this node's document.
Returns the list of XML::Error found when parsing this document.
Returns the first child node of this node that is an element.
Returns true if this is a DocumentFragment.
Returns the content for this Node.
Returns detailed information for this node including node type, name, attributes and children.
Returns the name for this Node.
Sets the name for this Node.
Returns the namespace for this node or nil if not found.
Returns namespaces in scope for self – those defined on self element directly or any ancestor node – as an Array of XML::Namespace objects.
Returns the next sibling node or nil if not found.
Returns the next element node sibling or nil if not found.
Returns the next sibling node or nil if not found.
Returns the address of underlying LibXML::Node* in memory.
Returns the parent node or nil if not found.
Returns the previous sibling node or nil if not found.
Returns the previous sibling node that is an element or nil if not found.
Returns the previous sibling node or nil if not found.
Returns true if this is a Processing Instruction node.
Returns the root node for this document or nil.
Same as #content.
Same as #content=.
Returns true if this is a Text node.
Serialize this Node as XML to io using default options.
Returns underlying LibXML::Node* instance.
Serialize this Node as XML and return a String using default options.
Serialize this Node as XML to io using default options.
Returns the type for this Node as XML::Node::Type.
Removes the node from the XML document.
Returns the version of this node's document.
Returns true if this is an xml Document node.
Searches this node for XPath path.
Searches this node for XPath path and restricts the return type to Bool.
Searches this node for XPath path and restricts the return type to Float64.
Searches this node for XPath path for nodes and returns the first one.
Searches this node for XPath path and restricts the return type to NodeSet.
Searches this node for XPath path and restricts the return type to String.
Struct
Value
Object
Object
Gets the attribute content for the attribute given by name. Raises KeyError if attribute is not found.
Sets attribute of this node to value. Raises XML::Error if this node does not support attributes.
Gets the attribute content for the attribute given by name. Returns nil if attribute is not found.
Returns true if this is an attribute node.
Returns attributes of this node as an XML::Attributes.
Returns true if this is a CDATA section node.
Gets the list of children for this node as a XML::NodeSet.
Returns true if this is a comment node.
Returns the content for this Node. An empty string is returned if the node has no content.
Sets the Node's content to a Text node containing string. The string gets XML escaped, not interpreted as markup.
Deletes attribute given by name. Returns attributes value, or nil if attribute not found.
Returns true if this is a Document or HTML Document node.
Returns true if this is an Element node.
Returns the encoding of this node's document.
Returns the list of XML::Error found when parsing this document. Returns nil if no errors were found.
Returns the first child node of this node that is an element. Returns nil if not found.
Returns true if this is a DocumentFragment.
Returns the content for this Node.
Returns detailed information for this node including node type, name, attributes and children.
Returns the name for this Node.
Sets the name for this Node.
Returns namespaces in scope for self – those defined on self element directly or any ancestor node – as an Array of XML::Namespace objects.
Default namespaces ("xmlns=" style) for self are included in this array; Default namespaces for ancestors, however, are not.
See also #namespaces
Returns a Hash(String, String?) of prefix => href for all namespaces on this node and its ancestors.
This method returns the same namespaces as #namespace_scopes.
Returns namespaces in scope for self – those defined on self element directly or any ancestor node – as a Hash of attribute-name/value pairs.
NOTE Note that the keys in this hash XML attributes that would be used to define this namespace, such as "xmlns:prefix", not just the prefix.
Returns the next sibling node or nil if not found.
Returns the next element node sibling or nil if not found.
Returns the next sibling node or nil if not found.
Returns the address of underlying LibXML::Node* in memory.
Returns the parent node or nil if not found.
Returns the previous sibling node or nil if not found.
Returns the previous sibling node that is an element or nil if not found.
Returns the previous sibling node or nil if not found. Same with #previous.
Returns true if this is a Processing Instruction node.
Returns the root node for this document or nil.
Returns true if this is a Text node.
Returns underlying LibXML::Node* instance.
Serialize this Node as XML and return a String using default options.
See XML::SaveOptions.xml_default for default options.
Serialize this Node as XML to io using default options.
See XML::SaveOptions.xml_default for default options.
Returns the type for this Node as XML::Node::Type.
Removes the node from the XML document.
Returns the version of this node's document.
Returns true if this is an xml Document node.
Searches this node for XPath path. Returns result with appropriate type (Bool | Float64 | String | XML::NodeSet).
Raises XML::Error on evaluation error.
Searches this node for XPath path and restricts the return type to Bool.
require "xml"
doc = XML.parse("<person></person>")
doc.xpath_bool("count(//person) > 0") # => true Searches this node for XPath path and restricts the return type to Float64.
require "xml"
doc = XML.parse("<person></person>")
doc.xpath_float("count(//person)") # => 1.0 Searches this node for XPath path for nodes and returns the first one. or nil if not found
require "xml"
doc = XML.parse("<person></person>")
doc.xpath_node("//person") # => #<XML::Node:0x2013e80 name="person">
doc.xpath_node("//invalid") # => nil Searches this node for XPath path and restricts the return type to NodeSet.
require "xml"
doc = XML.parse("<person></person>")
nodes = doc.xpath_nodes("//person")
nodes.class # => XML::NodeSet
nodes.map(&.name) # => ["person"] Searches this node for XPath path and restricts the return type to String.
require "xml"
doc = XML.parse("<person></person>")
doc.xpath_string("string(/persons/person[1])")
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/XML/Node.html