module XMLScan::XMLChar

Constants

CharPattern
NamePattern
NmtokenPattern
NotCharPattern
NotNameCharPattern

Public Class Methods

valid_char?(code) click to toggle source
   # File lib/xmlscan/xmlchar.rb
27 def valid_char?(code)
28   return false if code > 0x10ffff
29   NotCharPattern !~ [code].pack('U')
30 end
valid_chardata?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
32 def valid_chardata?(str)
33   NotCharPattern !~ str
34 end
valid_encoding?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
59 def valid_encoding?(str)
60   if /\A[A-Za-z]([\-A-Za-z0-9._])*\z/u =~ str then
61     true
62   else
63     false
64   end
65 end
valid_name?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
40 def valid_name?(str)
41   not NamePattern !~ str
42 end
valid_nmtoken?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
36 def valid_nmtoken?(str)
37   NotNameCharPattern !~ str
38 end
valid_version?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
53 def valid_version?(str)
54   /[^\-a-zA-Z0-9_.:]/u !~ str
55 end

Public Instance Methods

valid_pubid?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
48 def valid_pubid?(str)
49   /[^\- \r\na-zA-Z0-9'()+,.\/:=?;!*#\@$_%]/u !~ str
50 end

Private Instance Methods

valid_char?(code) click to toggle source
   # File lib/xmlscan/xmlchar.rb
27 def valid_char?(code)
28   return false if code > 0x10ffff
29   NotCharPattern !~ [code].pack('U')
30 end
valid_chardata?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
32 def valid_chardata?(str)
33   NotCharPattern !~ str
34 end
valid_encoding?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
59 def valid_encoding?(str)
60   if /\A[A-Za-z]([\-A-Za-z0-9._])*\z/u =~ str then
61     true
62   else
63     false
64   end
65 end
valid_name?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
40 def valid_name?(str)
41   not NamePattern !~ str
42 end
valid_nmtoken?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
36 def valid_nmtoken?(str)
37   NotNameCharPattern !~ str
38 end
valid_version?(str) click to toggle source
   # File lib/xmlscan/xmlchar.rb
53 def valid_version?(str)
54   /[^\-a-zA-Z0-9_.:]/u !~ str
55 end