Package org.apache.excalibur.xml.dom

Examples of org.apache.excalibur.xml.dom.DOMParser


        StringReader reader = new StringReader(pre+property.getValue().toString()+
                                               post);
        InputSource src = new InputSource(reader);

        DOMParser parser = null;
        Document doc = null;

        try {
            parser = (DOMParser) this.manager.lookup(DOMParser.ROLE);
            doc = parser.parseDocument(src);
        } catch (Exception e) {
            throw new SourceException("Could not parse property", e);
        } finally {
            this.manager.release((Component) parser);
        }
View Full Code Here


            return new SourceProperty[0];
        }

        Vector sourceproperties = new Vector();

        DOMParser parser = null;
        String xml = "";

        try {
            parser = (DOMParser) this.manager.lookup(DOMParser.ROLE);
            final String quote = "\"";

            for (Enumeration e = revisionDescriptor.enumerateProperties();
                e.hasMoreElements(); ) {
                NodeProperty property = (NodeProperty) e.nextElement();
                String name = property.getName();
                String namespace = property.getNamespace();
                String pre = "<"+name+" xmlns="+quote+namespace+quote+" >";
                String post = "</"+name+" >";

                xml = pre+property.getValue().toString()+post;
                StringReader reader = new StringReader(xml);

                Document doc = parser.parseDocument(new InputSource(reader));

                SourceProperty srcProperty = new SourceProperty(doc.getDocumentElement());

                sourceproperties.addElement(srcProperty);
            }
View Full Code Here

            }
        sendEndElementEvent(RESULT_ELEMENT);
    }

    private Document newDocument() throws SAXException, ServiceException {
        DOMParser parser = (DOMParser) this.manager.lookup(DOMParser.ROLE);
        try {
            return parser.createDocument();
        } finally {
            this.manager.release(parser);
        }
    }
View Full Code Here

            source = this.resolver.resolveURI(src);

            if (!"".equals(select)) {


                DOMParser parser = null;
                XPathProcessor processor = null;

                try {
                    parser = (DOMParser)this.manager.lookup(DOMParser.ROLE);
                    processor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE);

                    InputSource input = SourceUtil.getInputSource(source);

                    Document document = parser.parseDocument(input);
                    NodeList list = processor.selectNodeList(document, select);
                    int length = list.getLength();
                    for (int i=0; i<length; i++) {
                          IncludeXMLConsumer.includeNode(list.item(i),
                                               this.filter,
View Full Code Here

        int length = httpReq.getContentLength();
        PostInputStream reqContent = new PostInputStream(httpReq.getInputStream(), length);

        // construct DOM document from the request contents
        DOMParser parser = (DOMParser) this.manager.lookup(DOMParser.ROLE);
        InputSource saxSource = new InputSource(reqContent);
        Document requestDoc = parser.parseDocument(saxSource);

        // get the root element (should be "request") and its attributes ---> FixMe: Add error handling
        Element root = requestDoc.getDocumentElement();
        getLogger().debug("root element (should be 'request'): " + root.getTagName());
View Full Code Here

        int length = httpReq.getContentLength();
        PostInputStream reqContent = new PostInputStream(httpReq.getInputStream(), length);

        // construct DOM document from the request contents
        DOMParser parser = (DOMParser) this.manager.lookup(DOMParser.ROLE);
        InputSource saxSource = new InputSource(reqContent);
        Document requestDoc = parser.parseDocument(saxSource);

        // get the root element (should be "request") and its attributes ---> FixMe: Add error handling
        Element root = requestDoc.getDocumentElement();
        getLogger().debug(".act(): Root element (should be 'request'): " + root.getTagName());
View Full Code Here

     * @param doc org.w3c.dom.Document to save
     * @throws ProcessingException
     */
    private void saveDocumentToSource(Source docTarget, Document doc)
        throws ProcessingException {
        DOMParser parser = null;
        OutputStream os = null;
        String uri = docTarget.getURI();

        try {
            parser =
View Full Code Here

     * @return
     * @throws ProcessingException
     */
    private Document loadDocumentFromSource(Source documentSrc)
        throws ProcessingException {
        DOMParser parser = null;
        try {
            parser =
                (DOMParser) this.serviceManager.lookup(DOMParser.ROLE);
            getLogger().debug(
                "request to load file " + documentSrc.getURI());
            InputSource input = new InputSource(documentSrc.getURI());
            return parser.parseDocument(input);
        } catch (Exception e) {
            throw new ProcessingException(
                "failed to load file to bind to: ",
                e);
        } finally {
View Full Code Here

        String post = "</"+name+" >";

        StringReader reader = new StringReader(pre+property.getValue().toString()+post);
        InputSource src = new InputSource(reader);

        DOMParser parser = null;
        Document doc = null;

        try {
            parser = (DOMParser) this.m_manager.lookup(DOMParser.ROLE);
            doc = parser.parseDocument(src);
        } catch (Exception e) {
            throw new SourceException("Could not parse property", e);
        } finally {
            this.m_manager.release(parser);
        }
View Full Code Here

        if (m_descriptor == null) {
            return new SourceProperty[0];
        }

        List properties = new ArrayList();
        DOMParser parser = null;
        String xml = "";

        try {
            parser = (DOMParser) m_manager.lookup(DOMParser.ROLE);
            final String quote = "\"";
            Enumeration e = m_descriptor.enumerateProperties();
            while (e.hasMoreElements()) {
                NodeProperty property = (NodeProperty) e.nextElement();
                String name = property.getName();
                String namespace = property.getNamespace();
                String pre = "<"+name+" xmlns="+quote+namespace+quote+" >";
                String post = "</"+name+" >";
                xml = pre+property.getValue().toString()+post;
               
                StringReader reader = new StringReader(xml);
                Document doc = parser.parseDocument(new InputSource(reader));
                properties.add(new SourceProperty(doc.getDocumentElement()));
            }
        } catch (Exception e) {
            throw new SourceException("Could not parse property "+xml, e);
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.excalibur.xml.dom.DOMParser

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.