Module: ROXML::XML
- Defined in:
- lib/roxml/xml/parsers/libxml.rb,
lib/roxml/xml.rb,
lib/roxml/xml/parsers/nokogiri.rb
Overview
Defined Under Namespace
Modules: NamespacedSearch, NodeExtensions
Classes: Document, Element, Node
Class Method Summary
collapse
Class Method Details
.add_cdata(parent, content) ⇒ Object
23
24
25
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 23
def add_cdata(parent, content)
add_child(parent, LibXML::XML::Node.new_cdata(content))
end
|
.add_child(parent, child) ⇒ Object
27
28
29
30
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 27
def add_child(parent, child)
parent << child
child
end
|
.add_node(parent, name) ⇒ Object
19
20
21
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 19
def add_node(parent, name)
add_child(parent, new_node(name))
end
|
.new_node(name) ⇒ Object
15
16
17
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 15
def new_node(name)
LibXML::XML::Node.new(name)
end
|
.parse_file(path) ⇒ Object
36
37
38
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 36
def parse_file(path)
LibXML::XML::Parser.file(path).parse
end
|
.parse_io(stream) ⇒ Object
40
41
42
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 40
def parse_io(stream)
LibXML::XML::Parser.io(stream).parse
end
|
.parse_string(string) ⇒ Object
32
33
34
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 32
def parse_string(str_data)
LibXML::XML::Parser.string(str_data).parse
end
|
.save_doc(doc, path) ⇒ Object
44
45
46
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 44
def save_doc(doc, path)
doc.save(path)
end
|
.set_attribute(node, name, value) ⇒ Object
7
8
9
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 7
def set_attribute(node, name, value)
node.attributes[name] = value
end
|
.set_content(node, content) ⇒ Object
11
12
13
|
# File 'lib/roxml/xml/parsers/libxml.rb', line 11
def set_content(node, content)
node.content = content.gsub('&', '&')
end
|