Module: XML

Defined in:
lib/xml/sax.rb,
lib/xml/dom/core.rb,
lib/xml/parserns.rb,
lib/xml/dom2/attr.rb,
lib/xml/dom2/node.rb,
lib/xml/dom2/text.rb,
lib/xml/saxdriver.rb,
lib/xml/dom/digest.rb,
lib/xml/dom2/xpath.rb,
lib/xml/dom/builder.rb,
lib/xml/dom/visitor.rb,
lib/xml/dom2/entity.rb,
lib/xml/dom2/comment.rb,
lib/xml/dom2/element.rb,
lib/xml/dom2/document.rb,
lib/xml/dom2/nodelist.rb,
lib/xml/dom2/notation.rb,
lib/xml/dom2/dombuilder.rb,
lib/xml/dom2/cdatasection.rb,
lib/xml/dom2/documenttype.rb,
lib/xml/dom2/domexception.rb,
lib/xml/dom2/namednodemap.rb,
lib/xml/dom2/characterdata.rb,
lib/xml/dom2/dominputsource.rb,
lib/xml/dom2/entityreference.rb,
lib/xml/dom2/documentfragment.rb,
lib/xml/dom2/dombuilderfilter.rb,
lib/xml/dom2/domentityresolver.rb,
lib/xml/dom2/domimplementation.rb,
lib/xml/dom2/domentityresolverimpl.rb,
lib/xml/dom2/processinginstruction.rb,
ext/xmlparser.c

Overview

-*- Ruby -*- XML::DOM::DOMEntityResolver 2001 by yoshidam

Defined Under Namespace

Modules: DOM, SAX, Spec Classes: InternalParserNS, ParserNS

Constant Summary collapse

SimpleTree =
DOM
SimpleTreeBuilder =
DOM::Builder
ParserError =
eXMLParserError
Parser =
cXMLParser
Encoding =
cXMLEncoding

Class Method Summary collapse

Class Method Details

.charRef(s) ⇒ Object

Class Methods

--- XML.charRef(s)

replace character ‘&’,‘<’,‘>’,“‘”,’“‘ in string s to character reference.



34
35
36
37
38
39
40
41
42
# File 'lib/xml/dom/core.rb', line 34

def XML.charRef(s)
  str = s.dup
  str.gsub!("&", "&amp;")
  str.gsub!("<", "&lt;")
  str.gsub!(">", "&gt;")
  str.gsub!("'", "&apos;")
  str.gsub!('"', "&quot;")
  str
end