Class: Nokogiri::XML::ElementContent
- Inherits:
-
Object
- Object
- Nokogiri::XML::ElementContent
- Defined in:
- lib/nokogiri/xml/element_content.rb,
ext/nokogiri/xml_element_content.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 tree inside the <!ELEMENT> tag shown above that lists the possible content for the div1 tag.
Constant Summary collapse
- PCDATA =
Possible definitions of type
1
- ELEMENT =
2
- SEQ =
3
- OR =
4
- ONCE =
Possible content occurrences
1
- OPT =
2
- MULT =
3
- PLUS =
4
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#children ⇒ Object
Get the children of this ElementContent node.
-
#name ⇒ Object
Get the require element
name
. -
#occur ⇒ Object
Get the element content
occur
flag. -
#prefix ⇒ Object
Get the element content namespace
prefix
. -
#type ⇒ Object
Get the element content
type
.
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
29 30 31 |
# File 'lib/nokogiri/xml/element_content.rb', line 29 def document @document end |
Instance Method Details
#children ⇒ Object
Get the children of this ElementContent node
33 34 35 |
# File 'lib/nokogiri/xml/element_content.rb', line 33 def children [c1, c2].compact end |
#name ⇒ Object
Get the require element name
11 12 13 14 15 16 17 18 19 |
# File 'ext/nokogiri/xml_element_content.c', line 11
static VALUE
get_name(VALUE self)
{
xmlElementContentPtr elem;
Data_Get_Struct(self, xmlElementContent, elem);
if (!elem->name) { return Qnil; }
return NOKOGIRI_STR_NEW2(elem->name);
}
|
#occur ⇒ Object
Get the element content occur
flag. Possible values are ONCE, OPT, MULT or PLUS.
76 77 78 79 80 81 82 83 |
# File 'ext/nokogiri/xml_element_content.c', line 76
static VALUE
get_occur(VALUE self)
{
xmlElementContentPtr elem;
Data_Get_Struct(self, xmlElementContent, elem);
return INT2NUM((long)elem->ocur);
}
|
#prefix ⇒ Object
Get the element content namespace prefix
.
91 92 93 94 95 96 97 98 99 100 |
# File 'ext/nokogiri/xml_element_content.c', line 91
static VALUE
get_prefix(VALUE self)
{
xmlElementContentPtr elem;
Data_Get_Struct(self, xmlElementContent, elem);
if (!elem->prefix) { return Qnil; }
return NOKOGIRI_STR_NEW2(elem->prefix);
}
|
#type ⇒ Object
Get the element content type
. Possible values are PCDATA, ELEMENT, SEQ, or OR.
28 29 30 31 32 33 34 35 |
# File 'ext/nokogiri/xml_element_content.c', line 28
static VALUE
get_type(VALUE self)
{
xmlElementContentPtr elem;
Data_Get_Struct(self, xmlElementContent, elem);
return INT2NUM((long)elem->type);
}
|