CAKE IO xceres XML

CAKE uses XML for communication and storage format. This package provides some classes which simplify the usage of XML streams. The classes using the xerces XML package from the Apache project, see

XML Parser

To parse an XML stream the XMLParser can be used. The usage is quite simple:

        XMLParser parser = new XMLParser(this.getClass().getClassLoader());
        parser.setContentHandler(new DefaultHandler()); // use your own DefaultHandler

In the default configuration no validation is performed. To validate the content two special parsers are provided: DTDBasedParser and XMLSchemaBasedParser. The corresponding grammars are automatically loaded from the directory /resources/XML that must be in the classpath.

XML Writer

To write an XML stream the XMLSchemaBasedWriter is provided. The usage for an XML Schema writer is quite simple:

      XMLSchemaBasedWriter writer = new XMLSchemaBasedWriter("filename.xml");
      writer.setSchemaLocation("", "catl.xsd");
      writer.addImport("co", "");