Package com.volantis.xml.xerces.parsers

Examples of com.volantis.xml.xerces.parsers.SAXParser


     */
    private StyleCategory[] readCategories()
        throws Exception {

        // Get an XML reader
        final XMLReader reader = new SAXParser();

        // Construct an entity resolver that looks in the JAR that
        // contains the same class as this class, and use it to look
        // up the XML file
        final JarFileEntityResolver resolver = new JarFileEntityResolver(this);
        // add the mapping for the style-catorgories.xml file.
        resolver.addSystemIdMapping(
            STYLE_CATEGORIES_XML_URI,
            STYLE_CATEGORIES_XML_LOCATION);
        // add the mapping for the style-catorgories.xsd file.
        resolver.addSystemIdMapping(
            STYLE_CATEGORIES_SCHEMA_URI,
            STYLE_CATEGORIES_SCHEMA_LOCATION);

        final InputSource xmlInputSource =
            resolver.resolveEntity(null, STYLE_CATEGORIES_XML_URI);

        // Create a content handler and attach it to the reader
        final StyleCategoryContentHandler handler =
            new StyleCategoryContentHandler();
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(resolver);

        // Turn on schema validation
        reader.setFeature(
            "http://apache.org/xml/features/validation/schema", true);

        // Parse the XML file
        reader.parse(xmlInputSource);

        // Get the categories from the content handler
        final List catsList = handler.getStyleCategories();
        StyleCategory[] catsArray = new StyleCategory[catsList.size()];
        return (StyleCategory[])
View Full Code Here


        // Get an XMLFilter that will apply the transform.
        XMLFilter filter = saxTransformerFactory.newXMLFilter(templates);

        // Parse the input, pass it through the filter and create a DOM.
        XMLReader parser = new SAXParser();

        parser.setFeature("http://xml.org/sax/features/validation", true);
        parser.setFeature("http://apache.org/xml/features/validation/schema", true);

        filter.setParent(parser);

//        // todo validate input and output.
//        final PrintWriter writer = new PrintWriter(System.out);
//        filter.setContentHandler(new MyContentHandler(writer));
//        filter.setErrorHandler(new MyErrorHandler());
//
//        filter.parse(input);
//        if (true) {
//            writer.flush();
//            throw new RuntimeException();
//        }

        // Get the root node of the actual transformation result.
        Element actualRoot = getElement(filter, input);

        // Parse the expected result.
        parser = new SAXParser();

        Element expectedRoot = getElement(parser, expected);

        String actualString = JDOMUtils.convertToString(actualRoot);
        String expectedString = JDOMUtils.convertToString(expectedRoot);
View Full Code Here

        try {
            this.file = file;

            // create the XMLReader instance
            xmlReader = new SAXParser();
            xmlReader.setContentHandler(validationHandler);
            xmlReader.setErrorHandler(validationHandler);
            xmlReader.setEntityResolver(entityResolver);

            // set up the features that we need
View Full Code Here

     * @return The charsets root element.
     */
    public Charsets digest() {
       
        Charsets cs = null;
        Digester digester = new Digester(new SAXParser());

        ClassLoader loader = this.getClass().getClassLoader();
        InputStream stream =
            loader.getResourceAsStream(CHARSET_CONFIG_FILENAME);
        InputSource is = new InputSource(stream);
View Full Code Here

            throws IOException, SAXException {
        // Create the digester
        // @todo ought this digester use our repackaged parser?
        // I have used our repackaged parser to get it to work for now...
        // This will probably have to be changed as part of VBM:2003022702.
        Digester digester = new MarinerDigester(new SAXParser());
        digester.addObjectCreate("parent", ParentConf.class);
        digester.addObjectCreate("parent/enabled", EnabledConf.class);
        digester.addSetProperties("parent/enabled", "property", "property");
        digester.addSetNext("parent/enabled", "setEnabled");
       
View Full Code Here

TOP

Related Classes of com.volantis.xml.xerces.parsers.SAXParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.