Class: REXML::Validation::RelaxNG (Ruby 2.7.5)
Description: Class : REXML::Validation::RelaxNG - Ruby 2.7.5

### Home Classes Methods

### In Files

- rexml/validation/relaxng.rb

### Parent

Object

### Methods

- ::new
- #receive

### Included Modules

- REXML::Validation::Validator

### Class/Module Index

Quicksearch

- Array
- Float
- Integer
- Object
- REXML
- REXML::AttlistDecl
- REXML::Attribute
- REXML::Attributes
- REXML::CData
- REXML::Child
- REXML::Comment
- REXML::DTD
- REXML::DTD::AttlistDecl
- REXML::DTD::ElementDecl
- REXML::DTD::EntityDecl
- REXML::DTD::NotationDecl
- REXML::DTD::Parser
- REXML::Declaration
- REXML::DocType
- REXML::Document
- REXML::Element
- REXML::ElementDecl
- REXML::Elements
- REXML::Encoding
- REXML::Entity
- REXML::EntityConst
- REXML::ExternalEntity
- REXML::Formatters
- REXML::Formatters::Default
- REXML::Formatters::Pretty
- REXML::Formatters::Transitive
- REXML::Functions
- REXML::IOSource
- REXML::Instruction
- REXML::Light
- REXML::Light::Node
- REXML::Namespace
- REXML::Node
- REXML::NotationDecl
- REXML::Output
- REXML::Parent
- REXML::ParseException
- REXML::Parsers
- REXML::Parsers::BaseParser
- REXML::Parsers::LightParser
- REXML::Parsers::PullEvent
- REXML::Parsers::PullParser
- REXML::Parsers::SAX2Parser
- REXML::Parsers::StreamParser
- REXML::Parsers::TreeParser
- REXML::Parsers::UltraLightParser
- REXML::Parsers::XPathParser
- REXML::QuickPath
- REXML::ReferenceWriter
- REXML::SAX2Listener
- REXML::Security
- REXML::Source
- REXML::SourceFactory
- REXML::StreamListener
- REXML::Text
- REXML::UndefinedNamespaceException
- REXML::Validation
- REXML::Validation::Choice
- REXML::Validation::Event
- REXML::Validation::Interleave
- REXML::Validation::OneOrMore
- REXML::Validation::Optional
- REXML::Validation::Ref
- REXML::Validation::RelaxNG
- REXML::Validation::Sequence
- REXML::Validation::State
- REXML::Validation::ValidationException
- REXML::Validation::Validator
- REXML::Validation::ZeroOrMore
- REXML::XMLDecl
- REXML::XMLTokens
- REXML::XPath
- REXML::XPathNode
- REXML::XPathParser
- Symbol

No matching classes.

# REXML::Validation::RelaxNG

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

EMPTY
INFINITY
TEXT

### Attributes

count[RW]
current[RW]
references[R]

### Public Class Methods

new(source) click to toggle source

FIXME: Namespaces

                   # File 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

### Public Instance Methods

receive(event) click to toggle source

                   # File rexml/validation/relaxng.rb, line 122
    def receive event
      validate( event )
    end