Class: Nokogiri::XML::ElementContent
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
PP::Node
|
|
| Inherits: | Object |
| Defined in: | lib/nokogiri/xml/element_content.rb, ext/nokogiri/xml_element_content.c, ext/nokogiri/xml_node.c |
Overview
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.
Constant Summary
-
ELEMENT =
# File 'lib/nokogiri/xml/element_content.rb', line 212 -
MULT =
# File 'lib/nokogiri/xml/element_content.rb', line 283 -
ONCE =
# File 'lib/nokogiri/xml/element_content.rb', line 26
Possible content occurrences
1 -
OPT =
# File 'lib/nokogiri/xml/element_content.rb', line 272 -
OR =
# File 'lib/nokogiri/xml/element_content.rb', line 234 -
PCDATA =
# File 'lib/nokogiri/xml/element_content.rb', line 20
Possible definitions of type
1 -
PLUS =
# File 'lib/nokogiri/xml/element_content.rb', line 294 -
SEQ =
# File 'lib/nokogiri/xml/element_content.rb', line 223
PP::Node - Included
Instance Attribute Summary
- #document readonly
-
#name
readonly
Alias for Node#node_name.
Instance Method Summary
-
#children
Get the children of this
ElementContentnode. -
#occur(→ Integer)
- Returns
The content element’s #occur flag.
-
#prefix(→ String)
- Returns
The content element’s namespace #prefix.
-
#type(→ Integer)
- Returns
The content element’s #type.
-
#c1
private
Get the first child.
-
#c2
private
Get the second child.
- #inspect_attributes private
PP::Node - Included
Instance Attribute Details
#document (readonly)
[ GitHub ]# File 'lib/nokogiri/xml/element_content.rb', line 31
attr_reader :document
#name (readonly)
Alias for Node#node_name.
Instance Method Details
#c1 (private)
Get the first child.
# File 'ext/nokogiri/xml_element_content.c', line 44
static VALUE
get_c1(VALUE self)
{
xmlElementContentPtr elem;
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
if (!elem->c1) { return Qnil; }
return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c1);
}
#c2 (private)
Get the second child.
# File 'ext/nokogiri/xml_element_content.c', line 57
static VALUE
get_c2(VALUE self)
{
xmlElementContentPtr elem;
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
if (!elem->c2) { return Qnil; }
return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c2);
}
#children
Get the children of this ElementContent node
#inspect_attributes (private)
[ GitHub ]#occur(→ Integer)
[ GitHub ]# File 'ext/nokogiri/xml_element_content.c', line 73
static VALUE
get_occur(VALUE self)
{
xmlElementContentPtr elem;
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
return INT2NUM(elem->ocur);
}
#prefix(→ String)
- Returns
-
The content element’s namespace
prefix.
# File 'ext/nokogiri/xml_element_content.c', line 88
static VALUE
get_prefix(VALUE self)
{
xmlElementContentPtr elem;
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
if (!elem->prefix) { return Qnil; }
return NOKOGIRI_STR_NEW2(elem->prefix);
}
#type(→ Integer)
[ GitHub ]# File 'ext/nokogiri/xml_element_content.c', line 32
static VALUE
get_type(VALUE self)
{
xmlElementContentPtr elem;
TypedData_Get_Struct(self, xmlElementContent, &xml_element_content_type, elem);
return INT2NUM(elem->type);
}