trans / xmlproof
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
commit 58b1c450686fb1a60bb865ccb97ac6c182891c85
tree 86631ddc86c17a69c37da9a3af56ef0652a456f2
parent 546f4b13df0c4972764851e67796708841fde706
tree 86631ddc86c17a69c37da9a3af56ef0652a456f2
parent 546f4b13df0c4972764851e67796708841fde706
xmlproof /
README
= XMLProof/Ruby - An Implementation of xml:Proof for Ruby ==<a schema for the rest of us/> == Introduction XMLProof/Ruby is a 100% Ruby API for using xml:Proof, an alternate XML schema. It was born out of a need to typecast data taken from an XML Document. Imagine! All this just for that one simple need. But it seemed the right way to go about it. xml:Proof has prooved to be quite a sophisticated XML schema. == Requirements XMLProof/Ruby requires: * REREXML, available at "http://www.transami.net/files/ruby/index.html". * REXML, available at "http://www.germane-software.com/software/rexml/". == Usage First read the documentation for xml:Proof at "http://www.transami.net/files/ruby/xmlproof/xmlproof.html". For greater comprehension read the xml:Proof specification at "http://www.transami.net/files/ruby/xmlproof/xmlproof-spec.html". Example of using the proofreader: require 'xmlproof/proofreader' def validate(xml_filename) # create a proofreader prover = XMLProof::Proofreader.new # validate using document's internal schema instructions valid = proofreader.proofread_document_internal(xml_filename) # return results if valid puts "GOOD DOCUMENT" else puts "BAD DOCUMENT" prover.errors.each do |e| puts "namespace->#{e[0]} \t xpath->#{e[1]} \t error->#{e[2]}" end end end Another using external proofsheets: require 'xmlproof/proofreader' def validate_with(xml_filename, *proofsheet_files) # create a proof proofsheets = XMLProof::Proofsheets.new proofsheets.load_proofsheets(*proofsheet_files) proof = XMLProof::Proof.new(proofsheets) # create a proofreader using the proof proofreader = XMLProof::Proofreader.new proofreader.use_proof(proof) # validate valid = proofreader.proofread_document(xml) # return results if valid puts "GOOD DOCUMENT" else puts "BAD DOCUMENT" prover.errors.each do |e| puts "namespace->#{e[0]} \t xpath->#{e[1]} \t error->#{e[2]}" end end end Until a more detailed tutorial can be written, please refer to prooftool.rb for more concise examples, and refer to the API RDocs for further details. == Authentication Package:: XMLProof/Ruby Author:: Thomas Sawyer Requires:: Ruby 1.6.5+ License:: Copyright (c) 2002 Thomas Sawyer, transami@transami.net under the Ruby License

