| Path: | ReadMe.txt |
| Last Update: | Tue Jan 17 07:37:12 EST 2006 |
Pippin is a high level XML Schema based tool for:
If you are familiar with other Ruby XML tools, you may want to know how Pippin differs from REXML (www.germane-software.com/software/rexml/). Pippin is a layer on top of REXML that makes it even easier to work with XML documents that are described by XML schemas. Using Pippin is not much harder than digesting the XML schema, and pointing Pippin to an instance file to unmarshal, or an Object graph to marshal. Examples are shown in a later section.
Pippin relies on Roog determine how to map Objects and XML. There are two different categories of Objects that Pippin can marshal/unmarshal:
Roog (Ruby Object Ontology Generator) analyzes an XML schema and determines how to map its data onto Ruby Objects. As a side effect, it builds an in-memory database of meta-information related to this mapping. Once this has been done, you can either:
Pippin and Roog are currently pre-release software, which has not yet undergone internal reviews.
Pippin and Roog were originally made as part of the OffspringViewer for the IPC-2581 format. They have also been used for a Gerber-to-2581 translator, and a reverse translator. They have also been used for a viewer for Semi E120 files. Although some effort has been made to keep Roog and Pippin general, XML Schemas are complicated (some would say excessively). To determine if Roog can handle your schema, attempt to analyze the schema, and examine the warnings:
require 'nist/pippin/roog'
Roog::Analyzer.analyze 'path-to-XMLSchema'
Pippin can be downloaded in several forms:
cd $DevRoot/Projects/pippin
rake install_lib
require 'nist/pippin/roog' # Set attributes in roog_policy to modify Roog # behavior, if desired Roog::Analyzer.analyze 'path-to-XMLSchema' Roog::Semantics_Ruby.specialize Roog::Generator_Ruby.writeTo 'name-of-outputFile.rb' # If everything went well, you now have a file of # Ruby sourcecode that defines Objects described by # the input schema.
require 'nist/pippin/pippin' require 'nist/pippin/roog' require 'class-definitions-produced-by-Roog' # Set attributes in roog_policy and # Pippin::Policy.default if desired. # Prepare a Roog::Analyzer Roog::Analyzer.analyze 'path-to-XMLSchema' Roog::Semantics_Ruby.specialize analyzer = Roog::Analyzer.detach # Make a parser and a writer parser = Pippin::Parser.new analyzer writer = Pippin::Writer2.new analyzer # Unmarshal an XML file into an Object graph domainObject = parser.parse 'path-to-instance-doc' # If you would like to examine the result: domainObject.treeDump # Marshal an Object graph into an XML file writer.write domainObject, 'path-to-output-file'
Official contribution of the National Institute of Standards and Technology; not subject to copyright in the United States. Certain commercial equipment, instruments, or materials are identified in this paper to foster understanding. Such identification does not imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the materials or equipment identified are necessarily the best available for the purpose.