Implemented:
-
empty
-
element
-
attribute
-
text
-
optional
-
choice
-
oneOrMore
-
zeroOrMore
-
group
-
value
-
interleave
-
mixed
-
ref
-
grammar
-
start
-
define
Not implemented:
-
data
-
param
-
include
-
externalRef
-
notAllowed
-
anyName
-
nsName
-
except
-
name
Constants
No documentation available
No documentation available
No documentation available
Attributes
Read & Write
No documentation available
Read & Write
No documentation available
Read
No documentation available
Class Methods
::
lib/rexml/validation/relaxng.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rexml/validation/relaxng.rb, line 46
def initialize source
parser = REXML::Parsers::BaseParser.new( source )
@count = 0
@references = {}
@root = @current = Sequence.new(self)
@root.previous = true
states = [ @current ]
begin
event = parser.pull
case event[0]
when :start_element
case event[1]
when "empty"
when "element", "attribute", "text", "value"
states[-1] << event
when "optional"
states << Optional.new( self )
states[-2] << states[-1]
when "choice"
states << Choice.new( self )
states[-2] << states[-1]
when "oneOrMore"
states << OneOrMore.new( self )
states[-2] << states[-1]
when "zeroOrMore"
states << ZeroOrMore.new( self )
states[-2] << states[-1]
when "group"
states << Sequence.new( self )
states[-2] << states[-1]
when "interleave"
states << Interleave.new( self )
states[-2] << states[-1]
when "mixed"
states << Interleave.new( self )
states[-2] << states[-1]
states[-1] << TEXT
when "define"
states << [ event[2]["name"] ]
when "ref"
states[-1] << Ref.new( event[2]["name"] )
when "anyName"
states << AnyName.new( self )
states[-2] << states[-1]
when "nsName"
when "except"
when "name"
when "data"
when "param"
when "include"
when "grammar"
when "start"
when "externalRef"
when "notAllowed"
end
when :end_element
case event[1]
when "element", "attribute"
states[-1] << event
when "zeroOrMore", "oneOrMore", "choice", "optional",
"interleave", "group", "mixed"
states.pop
when "define"
ref = states.pop
@references[ ref.shift ] = ref
#when "empty"
end
when :end_document
states[-1] << event
when :text
states[-1] << event
end
end while event[0] != :end_document
end
FIXME: Namespaces
Instance Methods
lib/rexml/validation/relaxng.rb
View on GitHub
# File tmp/rubies/ruby-2.7.6/lib/rexml/validation/relaxng.rb, line 122
def receive event
validate( event )
end
No documentation available