Class: ValidateWebsite::Validator
- Inherits:
-
Object
- Object
- ValidateWebsite::Validator
- Defined in:
- lib/validate_website/validator.rb
Overview
Document validation from DTD or XSD (webservice for html5)
Constant Summary collapse
- XHTML_PATH =
File.('../../../data/schemas', __FILE__)
- HTML5_VALIDATOR_SERVICE =
'http://validator.w3.org/nu/'
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#dtd ⇒ Object
readonly
Returns the value of attribute dtd.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#original_doc ⇒ Object
readonly
Returns the value of attribute original_doc.
-
#xsd ⇒ Object
readonly
Returns the value of attribute xsd.
Instance Method Summary collapse
-
#initialize(original_doc, body, ignore = nil) ⇒ Validator
constructor
A new instance of Validator.
- #valid? ⇒ Boolean
Constructor Details
#initialize(original_doc, body, ignore = nil) ⇒ Validator
Returns a new instance of Validator.
18 19 20 21 22 23 24 25 |
# File 'lib/validate_website/validator.rb', line 18 def initialize(original_doc, body, ignore = nil) @original_doc = original_doc @body = body @ignore = ignore @dtd = @original_doc.internal_subset init_namespace(@dtd) @errors = [] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def body @body end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def doc @doc end |
#dtd ⇒ Object (readonly)
Returns the value of attribute dtd.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def dtd @dtd end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def errors @errors end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def namespace @namespace end |
#original_doc ⇒ Object (readonly)
Returns the value of attribute original_doc.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def original_doc @original_doc end |
#xsd ⇒ Object (readonly)
Returns the value of attribute xsd.
11 12 13 |
# File 'lib/validate_website/validator.rb', line 11 def xsd @xsd end |
Instance Method Details
#valid? ⇒ Boolean
29 30 31 |
# File 'lib/validate_website/validator.rb', line 29 def valid? errors.length == 0 end |