Module: XML::DOM

Included in:
Builder
Defined in:
lib/xml/dom/core.rb,
lib/xml/dom2/attr.rb,
lib/xml/dom2/node.rb,
lib/xml/dom2/text.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

Overview

Module XML::DOM (XML::SimpleTree)

Defined Under Namespace

Modules: DOMBuilderFilter, DOMEntityResolver Classes: Attr, Builder, CDATASection, CharacterData, Comment, DOMBuilder, DOMEntityResolverImpl, DOMException, DOMImplementation, DOMInputSource, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, NamedNodeMap, Node, NodeList, Notation, ProcessingInstruction, Text, Visitor

Constant Summary collapse

Attribute =

Class XML::DOM::Attribute

alias of Attr.

Attr

Class Method Summary collapse

Class Method Details

.tou16(str) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/xml/dom/digest.rb', line 13

def self.tou16(str)
  if defined?(::Encoding)
    str.encode(::Encoding::UTF_16BE).force_encoding(::Encoding::ASCII_8BIT)
  else
    str.unpack("U*").map {|v|
      if v >= 0x10000 && v <= 0x10ffff
        ## surrogate pair
        hi = ((v - 0x10000) >> 10) | 0xd800
        low = (v & 1023) | 0xdc00
        [hi, low].pack("n*")
      else
        [v].pack("n*")
      end
    }.join
  end
end