Class: Makiri::XML::DocumentFragment
- Inherits:
-
DocumentFragment
- Object
- Node
- DocumentFragment
- Makiri::XML::DocumentFragment
- Defined in:
- ext/makiri/makiri.c
Class Method Summary collapse
-
.Makiri::XML::DocumentFragment.parse(source) ⇒ DocumentFragment
Parse
sourceinto a standalone fragment with its own (empty) backing document.
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
Class Method Details
.Makiri::XML::DocumentFragment.parse(source) ⇒ DocumentFragment
Parse source into a standalone fragment with its own (empty) backing document. The fragment is self-contained: a prefixed name must declare its namespace within the fragment itself (use Document#fragment to parse against an existing document’s in-scope namespaces).
570 571 572 573 574 575 576 577 578 579 |
# File 'ext/makiri/glue/ruby_xml.c', line 570
static VALUE
mkr_xml_fragment_s_parse(VALUE klass, VALUE rb_source)
{
(void)klass;
VALUE doc_obj = mkr_xml_new_empty_document();
mkr_xml_doc_t *xdoc = mkr_parsed_xml_doc(mkr_doc_parsed(doc_obj));
mkr_xml_node_t *frag = mkr_xml_fragment_into(xdoc, rb_source, 0);
VALUE result = mkr_wrap_xml_node(frag, doc_obj);
return result;
}
|