Class: REXML::DTD::EntityDecl
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
           ::REXML::Child | |
| Instance Chain: 
          self,
           ::REXML::Child,::REXML::Node | |
| Inherits: | REXML::Child 
 | 
| Defined in: | lib/rexml/dtd/entitydecl.rb | 
Constant Summary
- 
    PERCENT =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 11/^\s*#{START}\s%\s(\w)\s((["']).*?\3)\s*>/um
- 
    PLAIN =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 10/^\s*#{START}\s(\w)\s+((["']).*?\3)\s*>/um
- 
    PUBLIC =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 8/^\s*#{START}\s(?:%\s)?(\w)\sPUBLIC\s((["']).*?\3)\s((["']).*?\5)\s*>/um
- 
    START =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 6"<!ENTITY"
- 
    START_RE =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 7/^\s*#{START}/um
- 
    SYSTEM =
    
 # File 'lib/rexml/dtd/entitydecl.rb', line 9/^\s*#{START}\s(?:%\s)?(\w)\sSYSTEM\s((["']).*?\3)(?:\sNDATA\s\w)?\s*>/um
Class Method Summary
- 
    
      .new(src)  ⇒ EntityDecl 
    
    constructor
    <!ENTITY name SYSTEM “…”> <!ENTITY name “…”>. 
- .parse_source(source, listener)
::REXML::Child - Inherited
| .new | Constructor. | 
Instance Attribute Summary
::REXML::Child - Inherited
| #next_sibling | Alias for Node#next_sibling_node. | 
| #next_sibling= | Sets the next sibling of this child. | 
| #parent | The Parent of this object. | 
| #parent= | Sets the parent of this child to the supplied argument. | 
| #previous_sibling | Alias for Node#previous_sibling_node. | 
| #previous_sibling= | Sets the previous sibling of this child. | 
::REXML::Node - Included
Instance Method Summary
::REXML::Child - Inherited
| #bytes | This doesn’t yet handle encodings. | 
| #document | 
 | 
| #remove | Removes this child from the parent. | 
| #replace_with | Replaces this object with another object. | 
::REXML::Node - Included
| #each_recursive | Visit all subnodes of  | 
| #find_first_recursive | Find (and return) first subnode (recursively) for which the block evaluates to true. | 
| #indent, | |
| #index_in_parent | Returns the position that  | 
| #next_sibling_node, #previous_sibling_node, | |
| #to_s | 
 | 
Constructor Details
    .new(src)  ⇒ EntityDecl 
  
<!ENTITY name SYSTEM “…”> <!ENTITY name “…”>
# File 'lib/rexml/dtd/entitydecl.rb', line 14
def initialize src super() md = nil if src.match( PUBLIC ) md = src.match( PUBLIC, true ) @middle = "PUBLIC" @content = "#{md[2]} #{md[4]}" elsif src.match( SYSTEM ) md = src.match( SYSTEM, true ) @middle = "SYSTEM" @content = md[2] elsif src.match( PLAIN ) md = src.match( PLAIN, true ) @middle = "" @content = md[2] elsif src.match( PERCENT ) md = src.match( PERCENT, true ) @middle = "" @content = md[2] end raise ParseException.new("failed Entity match", src) if md.nil? @name = md[1] end
Class Method Details
.parse_source(source, listener)
[ GitHub ]# File 'lib/rexml/dtd/entitydecl.rb', line 50
def EntityDecl.parse_source source, listener md = source.match( PATTERN_RE, true ) thing = md[0].squeeze(" \t\n\r") listener.send inspect.downcase, thing end
Instance Method Details
#to_s
[ GitHub ]# File 'lib/rexml/dtd/entitydecl.rb', line 38
def to_s rv = "<!ENTITY #@name " rv << "#@middle " if @middle.size > 0 rv << @content rv end
#write(output, indent)
[ GitHub ]# File 'lib/rexml/dtd/entitydecl.rb', line 45
def write( output, indent ) indent( output, indent ) output << to_s end