Class: Nokogiri::XML::Schematron::Rule

Inherits:
Base
  • Object
show all
Defined in:
lib/nokogiri/xml/schematron/rule.rb

Overview

The internal representation of the <sch:rule> XML element.

For example:

rule = Nokogiri::XML::Schematron::Rule.new(nil, id: "rule1", context: "//ex:Example")
# => #<Nokogiri::XML::Schematron::Rule:0x00007fa1fb9e8410 @parent=nil, @children=[], @options={:id=>"rule1", :context=>"//ex:Example"}>
rule.to_builder.to_xml
# => "<?xml version=\"1.0\"?>\n<sch:rule xmlns:sch=\"http://purl.oclc.org/dsdl/schematron\" id=\"rule1\" context=\"//ex:Example\"/>\n"

Instance Attribute Summary collapse

Attributes inherited from Base

#children, #options, #parent

Instance Method Summary collapse

Methods inherited from Base

attribute, element, #initialize, #to_builder

Constructor Details

This class inherits a constructor from Nokogiri::XML::Schematron::Base

Instance Attribute Details

#contextString

Returns the value of the @context XML attribute.

Returns:

  • (String)

    the value of the @context XML attribute.



19
# File 'lib/nokogiri/xml/schematron/rule.rb', line 19

attribute :context

#idString

Returns the value of the @id XML attribute.

Returns:

  • (String)

    the value of the @id XML attribute.



23
# File 'lib/nokogiri/xml/schematron/rule.rb', line 23

attribute :id

Instance Method Details

#assert(**options) {|assert| ... } ⇒ Nokogiri::XML::Schematron::Assertion

Create a new Assertion object.

Parameters:

  • options (Hash<Symbol, Object>)

    the options.

Options Hash (**options):

  • :message (String)

    the text content of the <sch:assert> XML element.

  • :test (String)

    the value of the @test XML attribute.

Yield Parameters:

Yield Returns:

  • (void)

Returns:



33
# File 'lib/nokogiri/xml/schematron/rule.rb', line 33

element :assert, Nokogiri::XML::Schematron::Assertion