Class: Nokogiri::XML::Namespace
- Inherits:
-
Object
- Object
- Nokogiri::XML::Namespace
- Includes:
- PP::Node
- Defined in:
- lib/nokogiri/xml/namespace.rb,
lib/nokogiri/ffi/xml/namespace.rb,
ext/nokogiri/xml_namespace.c
Instance Attribute Summary collapse
-
#cstruct ⇒ Object
:stopdoc:.
-
#document ⇒ Object
Returns the value of attribute document.
Class Method Summary collapse
Instance Method Summary collapse
-
#href ⇒ Object
Get the href for this namespace.
-
#prefix ⇒ Object
Get the prefix for this namespace.
Methods included from PP::Node
Instance Attribute Details
#cstruct ⇒ Object
:stopdoc:
6 7 8 |
# File 'lib/nokogiri/ffi/xml/namespace.rb', line 6 def cstruct @cstruct end |
#document ⇒ Object
Returns the value of attribute document.
5 6 7 |
# File 'lib/nokogiri/xml/namespace.rb', line 5 def document @document end |
Class Method Details
.wrap(document, node_struct) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/nokogiri/ffi/xml/namespace.rb', line 18 def wrap(document, node_struct) if node_struct.is_a?(FFI::Pointer) # cast native pointers up into a node cstruct return nil if node_struct.null? node_struct = LibXML::XmlNs.new(node_struct) end ruby_node = node_struct.ruby_node return ruby_node unless ruby_node.nil? ns = Nokogiri::XML::Namespace.allocate ns.document = document.ruby_doc ns.cstruct = node_struct ns.cstruct.ruby_node = ns cache = ns.document.instance_variable_get(:@node_cache) cache << ns ns end |
Instance Method Details
#href ⇒ Object
Get the href for this namespace
30 31 32 |
# File 'ext/nokogiri/xml_namespace.c', line 30 def href cstruct[:href].nil? ? nil : cstruct[:href] # TODO: encoding? end |
#prefix ⇒ Object
Get the prefix for this namespace. Returns nil
if there is no prefix.
11 12 13 |
# File 'ext/nokogiri/xml_namespace.c', line 11 def prefix cstruct[:prefix].nil? ? nil : cstruct[:prefix] # TODO: encoding? end |