Ack,

Pushed and BZ updated.

Thanks

On 09/26/2012 02:24 PM, Jason Guiditta wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=821341

Nokogiri behave differently if it is initialized with strict parsing
config, as we were already doing in the TemplateXML object
initializer.
---
  lib/aeolus_cli/command/base_command.rb  |    6 +++++-
  lib/aeolus_cli/command/build_command.rb |    1 -
  2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/aeolus_cli/command/base_command.rb 
b/lib/aeolus_cli/command/base_command.rb
index 8ae8429..6ac250d 100644
--- a/lib/aeolus_cli/command/base_command.rb
+++ b/lib/aeolus_cli/command/base_command.rb
@@ -79,7 +79,11 @@ module Aeolus
def validate_xml_document(schema_path, xml_string)
          schema = Nokogiri::XML::RelaxNG(File.read(schema_path))
-        doc = Nokogiri::XML xml_string
+       begin
+          doc = Nokogiri::XML(xml_string) { |config| config.strict }
+       rescue Nokogiri::XML::SyntaxError => e
+         return [e]
+       end
          schema.validate(doc)
        end
diff --git a/lib/aeolus_cli/command/build_command.rb b/lib/aeolus_cli/command/build_command.rb
index c2978e9..c219c18 100644
--- a/lib/aeolus_cli/command/build_command.rb
+++ b/lib/aeolus_cli/command/build_command.rb
@@ -66,7 +66,6 @@ module Aeolus
        def validate_xml_schema(xml)
          errors = validate_xml_document(File.dirname(__FILE__) + 
"/../../../examples/tdl.rng", xml)
          if errors.length > 0
-          puts "ERROR: The given Template does not conform to the TDL Schema, see 
below for specific details:"
            errors.each do |error|
              puts "- Line: " + error.line.to_s + " => " + error.message
            end


Reply via email to