Module: Rng

Defined in:
lib/rng.rb,
lib/rng/cli.rb,
lib/rng/div.rb,
lib/rng/ref.rb,
lib/rng/data.rb,
lib/rng/list.rb,
lib/rng/name.rb,
lib/rng/text.rb,
lib/rng/empty.rb,
lib/rng/group.rb,
lib/rng/mixed.rb,
lib/rng/param.rb,
lib/rng/start.rb,
lib/rng/value.rb,
lib/rng/choice.rb,
lib/rng/define.rb,
lib/rng/except.rb,
lib/rng/to_rnc.rb,
lib/rng/element.rb,
lib/rng/grammar.rb,
lib/rng/include.rb,
lib/rng/ns_name.rb,
lib/rng/pattern.rb,
lib/rng/version.rb,
lib/rng/any_name.rb,
lib/rng/optional.rb,
lib/rng/attribute.rb,
lib/rng/parse_rnc.rb,
lib/rng/interleave.rb,
lib/rng/namespaces.rb,
lib/rng/parent_ref.rb,
lib/rng/rnc_parser.rb,
lib/rng/not_allowed.rb,
lib/rng/one_or_more.rb,
lib/rng/rnc_builder.rb,
lib/rng/external_ref.rb,
lib/rng/zero_or_more.rb,
lib/rng/documentation.rb,
lib/rng/foreign_element.rb,
lib/rng/schema_preamble.rb,
lib/rng/schema_validator.rb,
lib/rng/foreign_attribute.rb,
lib/rng/include_processor.rb,
lib/rng/test_suite_parser.rb,
lib/rng/datatype_declaration.rb,
lib/rng/parse_tree_processor.rb,
lib/rng/rnc_to_rng_converter.rb,
lib/rng/external_ref_resolver.rb,
lib/rng/namespace_declaration.rb

Defined Under Namespace

Modules: Namespaces, ParseRnc, ToRnc Classes: AnyName, Attribute, CLI, CLIError, Choice, ConversionError, Data, DatatypeDeclaration, Define, Div, Documentation, Element, Empty, Error, Except, ExternalRef, ExternalRefResolver, FileError, ForeignAttribute, ForeignElement, Grammar, Group, Include, IncludeProcessor, Interleave, List, Mixed, Name, NamespaceDeclaration, NotAllowed, NsName, OneOrMore, Optional, Param, ParentRef, ParseError, ParseTreeProcessor, Pattern, Ref, RncBuilder, RncParser, RncToRngConverter, SchemaPreamble, SchemaValidationError, SchemaValidator, Start, TestSuiteParser, Text, ValidationError, Value, ZeroOrMore

Constant Summary collapse

VERSION =
'0.3.4'

Class Method Summary collapse

Class Method Details

.parse(rng, location: nil, nested_schema: false, validate: false, resolve_external: false) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/rng.rb', line 67

def parse(rng, location: nil, nested_schema: false, validate: false, resolve_external: false)
  SchemaValidator.validate(rng) if validate && !nested_schema
  grammar = Grammar.from_xml(rng)
  return grammar unless resolve_external

  ExternalRefResolver.new(grammar, location: location).resolve
end

.parse_file(file_path) ⇒ Object



79
80
81
# File 'lib/rng.rb', line 79

def self.parse_file(file_path)
  RncParser.parse_file(file_path)
end

.parse_rnc(rnc_string) ⇒ Object

Add class-level parsing method



23
24
25
# File 'lib/rng/parse_rnc.rb', line 23

def self.parse_rnc(rnc)
  ParseRnc.parse(rnc)
end

.to_rnc(schema) ⇒ Object

Add class-level conversion method



21
22
23
24
# File 'lib/rng/to_rnc.rb', line 21

def self.to_rnc(schema)
  # Convert RNG schema to RNC
  ToRnc.convert(schema)
end