Automatic XML Parser Generator
Andreas Franke
- provides
- x-ozlib://mathweb/dtdtool.exe
- x-ozlib://mathweb/xmlparser/XmlScanner.ozf
- x-ozlib://mathweb/xmlparser/XmlParser.ozf
- x-ozlib://mathweb/xmlparser/ExpatEmulator.ozf
- x-ozlib://mathweb/xmlparser/GumpScannerEmulator.ozf
- x-ozlib://mathweb/xmlparser/SemTrivial.ozf
- x-ozlib://mathweb/xmlparser/SemDefault.ozf
- x-ozlib://mathweb/xmlread.exe
- x-ozlib://mathweb/text2functor.exe
- requires
- x-ozlib://duchier/op/InputSource.ozf
- is compatible with
- x-ozlib://duchier/xml/expat/Processor.ozf
Purpose
This tool automatically converts XML Document Type Definitions (DTDs)
into Oz Parsers (Gump). These are used to build user-specific
Oz-representations (e.g. tree structures) from XML documents.
The use of ``semantic modules'' makes it both powerful and easy-to-use:
- you can use predefined default modules
- you can easily create new modules (e.g. using the ``otherwise'' method)
- you can define specialized methods to generate any Oz-representation you want
Installation
This package can be installed by following the usual
configure, build, install procedure, i.e. by executing a the
shell:
./configure
make install
By default, all files of the package are
installed in the user's ~/.oz directory tree. In
particular, all modules are installed in the user's private cache.
Example
You need:
- some XML documents (e.g. ./examples/omobj.xml)
- and a DTD for them (e.g. ./examples/omobj.dtd)
Then you can use the tool as follows:
- Make sure that you have $HOME/.oz/bin in your $PATH.
- Convert the DTD to a Gump Parser:
dtdtool <DTD> --root=<Element>[,<Element>...] -o <ParserFunctor.ozf>
where the root elements are the documents' possible root nodes
- Test whether you can parse your documents:
xmlread <DOC.xml> --parser=<ParserFunctor.ozf> --root=<Element>
- Create an appropriate ``semantic module'' for your application
(analogous to SemDefault.oz)
- Test if it works:
xmlread <DOC.xml> --parser=<Parser.ozf> --root=<Elem> --sem=<SemFunctor.ozf>
- Integrate the parser into your application
(analogous to xmlread.oz)
- Replace ExpatEmulator.ozf with expat.ozf to improve efficiency
(available from Denys Duchier )
Omega Homepage -
MathWeb Homepage