Class | Nokogiri::XML::Document |
In: |
lib/nokogiri/xml/document.rb
|
Parent: | Nokogiri::XML::Node |
Nokogiri::XML::Document is the main entry point for dealing with XML documents. The Document is created by parsing an XML document. See Nokogiri.XML()
For searching a Document, see Nokogiri::XML::Node#css and Nokogiri::XML::Node#xpath
serialize | -> | to_xml |
dup | -> | clone |
errors | [RW] | A list of Nokogiri::XML::SyntaxError found when parsing a document |
Parse an XML file. thing may be a String, or any object that responds to read and close such as an IO, or StringIO. url is resource where this document is located. encoding is the encoding that should be used when processing the document. options is a number that sets options in the parser, such as Nokogiri::XML::ParseOptions::RECOVER. See the constants in Nokogiri::XML::ParseOptions.
Recursively get all namespaces from this node and its subtree and return them as a hash.
For example, given this document:
<root xmlns:foo="bar"> <bar xmlns:hello="world" /> </root>
This method will return:
{ 'xmlns:foo' => 'bar', 'xmlns:hello' => 'world' }
WARNING: this method will clobber duplicate names in the keys. For example, given this document:
<root xmlns:foo="bar"> <bar xmlns:foo="baz" /> </root>
The hash returned will look like this: { ‘xmlns:foo’ => ‘bar’ }
Create a Nokogiri::XML::DocumentFragment from tags Returns an empty fragment if tags is nil.