Class: Nokolexbor::CDATA
- Inherits:
-
Text
- Object
- Node
- CharacterData
- Text
- Nokolexbor::CDATA
- Defined in:
- ext/nokolexbor/nl_cdata.c
Constant Summary
Constants inherited from Node
Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAG_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::ENTITY_NODE, Node::ENTITY_REF_NODE, Node::LOOKS_LIKE_XPATH, Node::NOTATION_NODE, Node::PI_NODE, Node::TEXT_NODE
Instance Attribute Summary
Attributes inherited from Node
Class Method Summary collapse
Methods inherited from Node
#<<, #==, #[], #[]=, #add_child, #add_class, #add_next_sibling, #add_previous_sibling, #add_sibling, #after, #ancestors, #append_class, #at, #at_css, #at_css_impl, #at_xpath, #attribute, #attributes, #attrs, #before, #cdata?, #child, #children, #children=, #classes, #clone, #comment?, #content, #content=, #css, #css_impl, #destroy, #document?, #each, #element?, #first_element_child, #fragment, #fragment?, #inner_html, #key?, #keys, #keywordify, #kwattr_add, #kwattr_append, #kwattr_remove, #kwattr_values, #last_element_child, #matches?, #name, #next, #next_element, #node_type, #nokogiri_at_css, #nokogiri_css, #outer_html, #parent, #parent=, #parse, #prepend_child, #previous, #previous_element, #processing_instruction?, #remove, #remove_attr, #remove_class, #replace, #search, #text?, #traverse, #values, #wrap, #write_to, #xpath
Class Method Details
.new(*args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'ext/nokolexbor/nl_cdata.c', line 7 static VALUE nl_cdata_new(int argc, VALUE *argv, VALUE klass) { lxb_dom_document_t *document; VALUE rb_content; VALUE rb_document; VALUE rest; rb_scan_args(argc, argv, "2*", &rb_content, &rb_document, &rest); if (!rb_obj_is_kind_of(rb_document, cNokolexborDocument)) { rb_raise(rb_eArgError, "Document must be a Nokolexbor::Document"); } document = nl_rb_document_unwrap(rb_document); const char *c_content = StringValuePtr(rb_content); size_t content_len = RSTRING_LEN(rb_content); lxb_dom_cdata_section_t *element = lxb_dom_document_create_cdata_section(document, (const lxb_char_t *)c_content, content_len); if (element == NULL) { rb_raise(rb_eRuntimeError, "Error creating text node"); } VALUE rb_node = nl_rb_node_create(&element->text.char_data.node, rb_document); if (rb_block_given_p()) { rb_yield(rb_node); } return rb_node; } |