Package org.apache.felix.ipojo.xml.parser

Examples of org.apache.felix.ipojo.xml.parser.XMLMetadataParser


        // First time we've been called: parse the XML Stream
        List<Element> metadata = new ArrayList<Element>();

        try {
            XMLMetadataParser handler = new XMLMetadataParser();

            XMLReader parser = XMLReaderFactory.createXMLReader();
            parser.setContentHandler(handler);
            parser.setFeature("http://xml.org/sax/features/validation", true);
            parser.setFeature("http://apache.org/xml/features/validation/schema", true);
            parser.setErrorHandler(handler);
            if (m_validateUsingLocalSchemas) {
                parser.setEntityResolver(new SchemaResolver());
            }

            // Parse the XML
            InputSource is = new InputSource(m_stream);
            parser.parse(is);
            Element[] meta = handler.getMetadata();

            // Add parsed metadata
            if (meta != null) {
                metadata.addAll(Arrays.asList(meta));
            }
View Full Code Here


     */
    private void parseXMLMetadata(InputStream stream) {
        Element[] meta = null;
        try {
            XMLReader parser = XMLReaderFactory.createXMLReader();
            XMLMetadataParser handler = new XMLMetadataParser();
            parser.setContentHandler(handler);
            parser.setFeature("http://xml.org/sax/features/validation",
                    true);
            parser.setFeature("http://apache.org/xml/features/validation/schema",
                    true);

            parser.setErrorHandler(handler);

            if (! m_ignoreLocalXSD) {
                parser.setEntityResolver(new SchemaResolver());
            }

            InputSource is = new InputSource(stream);
            parser.parse(is);
            meta = handler.getMetadata();
            stream.close();

        } catch (IOException e) {
            error("Cannot open the metadata input stream: " + e.getMessage());
        } catch (ParseException e) {
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.xml.parser.XMLMetadataParser

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.