Class: Makiri::XML::DocumentType

Inherits:
DocumentType show all
Defined in:
ext/makiri/makiri.c

Instance Method Summary collapse

Methods inherited from Node

#add_class, #append_class, #at, #attribute, #attribute?, #attributes, #blank?, #cdata?, #classes, #clone, #comment?, #document?, #document_fragment?, #dup, #each, #element?, #inspect, #path, #processing_instruction?, #remove_class, #root, #search, #set_attribute, #text?, #to_h, #traverse

Instance Method Details

#external_idObject

—- DTD (DOCUMENT_TYPE) identifiers —-

The off-tree doctype node repurposes fields: local/qname = the DOCTYPE name (Node#name), prefix = the PUBLIC/external id, value = the SYSTEM id. A field left NULL means that id was absent (-> nil); an empty literal (e.g. PUBLIC “”) is a non-NULL 0-length slice (-> “”). Mirrors Nokogiri::XML::DTD#external_id / #system_id; #public_id is a WHATWG-DOM-style alias of #external_id. The DTD itself is NOT parsed (no entities/elements), so there is nothing else to read.



108
109
110
111
112
113
# File 'ext/makiri/glue/ruby_xml_node.c', line 108

static VALUE
mkr_xml_dtd_external_id(VALUE self)
{
    mkr_xml_node_t *n = mkr_xml_node_unwrap(self);
    return n->prefix == NULL ? Qnil : rb_utf8_str_new(n->prefix, (long)n->prefix_len);
}

#public_idObject

—- DTD (DOCUMENT_TYPE) identifiers —-

The off-tree doctype node repurposes fields: local/qname = the DOCTYPE name (Node#name), prefix = the PUBLIC/external id, value = the SYSTEM id. A field left NULL means that id was absent (-> nil); an empty literal (e.g. PUBLIC “”) is a non-NULL 0-length slice (-> “”). Mirrors Nokogiri::XML::DTD#external_id / #system_id; #public_id is a WHATWG-DOM-style alias of #external_id. The DTD itself is NOT parsed (no entities/elements), so there is nothing else to read.



108
109
110
111
112
113
# File 'ext/makiri/glue/ruby_xml_node.c', line 108

static VALUE
mkr_xml_dtd_external_id(VALUE self)
{
    mkr_xml_node_t *n = mkr_xml_node_unwrap(self);
    return n->prefix == NULL ? Qnil : rb_utf8_str_new(n->prefix, (long)n->prefix_len);
}

#system_idObject



115
116
117
118
119
120
# File 'ext/makiri/glue/ruby_xml_node.c', line 115

static VALUE
mkr_xml_dtd_system_id(VALUE self)
{
    mkr_xml_node_t *n = mkr_xml_node_unwrap(self);
    return n->value == NULL ? Qnil : rb_utf8_str_new(n->value, (long)n->value_len);
}