class Nokogiri::XML::ElementContent
Represents the allowed content in an Element
Declaration inside a DTD:
<?xml version="1.0"?><?TEST-STYLE PIDATA?> <!DOCTYPE staff SYSTEM "staff.dtd" [ <!ELEMENT div1 (head, (p | list | note)*, div2*)> ]> </root>
ElementContent
represents the binary tree inside the <!ELEMENT> tag shown above that lists the possible content for the div1 tag.
Constants
- ELEMENT
- MULT
- ONCE
-
Possible content occurrences
- OPT
- OR
- PCDATA
-
Possible definitions of type
- PLUS
- SEQ
Attributes
Public Instance Methods
Source
# File lib/nokogiri/xml/element_content.rb, line 35 def children [c1, c2].compact end
Get the children of this ElementContent
node
Source
static VALUE get_name(VALUE self) { xmlElementContentPtr elem; TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem); if (!elem->name) { return Qnil; } return NOKOGIRI_STR_NEW2(elem->name); }
- Returns
-
The content element’s
name
Source
static VALUE get_occur(VALUE self) { xmlElementContentPtr elem; TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem); return INT2NUM(elem->ocur); }
- Returns
-
The content element’s
occur
flag. Possible values areONCE
,OPT
,MULT
orPLUS
.
Source
static VALUE get_prefix(VALUE self) { xmlElementContentPtr elem; TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem); if (!elem->prefix) { return Qnil; } return NOKOGIRI_STR_NEW2(elem->prefix); }
- Returns
-
The content element’s namespace
prefix
.
Source
static VALUE get_type(VALUE self) { xmlElementContentPtr elem; TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem); return INT2NUM(elem->type); }
- Returns
-
The content element’s
type
. Possible values arePCDATA
,ELEMENT
,SEQ
, orOR
.