Package org.apache.lenya.xml

Examples of org.apache.lenya.xml.DOMParserFactory


                " example.xml \"/Example/People/Person[position() < 2]/Street/@Number\"");

            return;
        }

        DOMParserFactory dpf = new DOMParserFactory();
        Document document = null;

        try {
            document = dpf.getDocument(args[0]);
        } catch (Exception e) {
            System.err.println(xpointer.getClass().getName() + ".main(): " + e);
        }

        Element root = document.getDocumentElement();
View Full Code Here


    /** @see junit.framework.TestCase#setUp() */
    protected void setUp() throws Exception {
    /**
     * initialise the RCML-document. Delete all entries
     */
      DOMParserFactory dpf = new DOMParserFactory();
      document = dpf.getDocument();

      Element root = dpf.newElementNode(document, "XPSRevisionControl");
      document.appendChild(root);

    }
View Full Code Here

        if ("save".equals(reqType) || "checkin".equals(reqType)) {
            getLogger().debug(".act(): Write to temp file: " + tempFile);

            try {
                Element contentNode = (Element) data.getFirstChild();
                DOMParserFactory dpf = new DOMParserFactory();

                // Create a new document, where the actual content starts at the root element, which is the inner part of requestDoc
                Document contentDocument = dpf.getDocument();
                contentDocument.appendChild(
                    dpf.cloneNode(contentDocument, contentNode, true));
                new DOMWriter(new FileOutputStream(tempFile)).printWithoutFormatting(
                    contentDocument);
            } catch (Exception e) {
                getLogger().error(".act(): Exception during writing to temp file", e);
            }
View Full Code Here

    /** @see junit.framework.TestCase#setUp() */
    protected void setUp() throws Exception {
    /**
     * initialise the RCML-document. Delete all entries
     */
      DOMParserFactory dpf = new DOMParserFactory();
      document = dpf.getDocument();

      Element root = dpf.newElementNode(document, "XPSRevisionControl");
      document.appendChild(root);

    }
View Full Code Here

            File parent = new File(rcmlFile.getParent());
            parent.mkdirs();

            write();
        } else {
            DOMParserFactory dpf = new DOMParserFactory();
            document = dpf.getDocument(rcmlFile.getAbsolutePath());
        }
    }
View Full Code Here

    /**
     * initialise the RCML-document. Delete all entries
     */
    public void initDocument() {
        DOMParserFactory dpf = new DOMParserFactory();
        document = dpf.getDocument();

        Element root = dpf.newElementNode(document, "XPSRevisionControl");
        document.appendChild(root);
    }
View Full Code Here

     * @throws IOException if an error occurs
     * @throws Exception if an error occurs
     */
    public void checkOutIn(short type, String identity, long time)
        throws IOException, Exception {
        DOMParserFactory dpf = new DOMParserFactory();

        Element identityElement = dpf.newElementNode(document, "Identity");
        identityElement.appendChild(dpf.newTextNode(document, identity));

        Element timeElement = dpf.newElementNode(document, "Time");
        timeElement.appendChild(dpf.newTextNode(document, "" + time));

        Element checkOutElement = null;

        if (type == co) {
            checkOutElement = dpf.newElementNode(document, "CheckOut");
        } else if (type == ci) {
            checkOutElement = dpf.newElementNode(document, "CheckIn");
        } else {
            log.error("ERROR: " + this.getClass().getName() + ".checkOutIn(): No such type");

            return;
        }

        checkOutElement.appendChild(identityElement);
        checkOutElement.appendChild(timeElement);

        Element root = document.getDocumentElement();
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
        root.insertBefore(checkOutElement, root.getFirstChild());
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());

        setDirty();

        // If this is a checkout, we write back the changed state
        // to the file immediately because otherwise another
View Full Code Here

     * @return org.w3c.dom.Document The clone document
     *
     * @throws Exception if an error occurs
     */
    public org.w3c.dom.Document getDOMDocumentClone() throws Exception {
        Document documentClone = new DOMParserFactory().getDocument();
        documentClone.appendChild(documentClone.importNode(document.getDocumentElement(), true));

        return documentClone;
    }
View Full Code Here

    /** @see junit.framework.TestCase#setUp() */
    protected void setUp() throws Exception {
    /**
     * initialise the RCML-document. Delete all entries
     */
      DOMParserFactory dpf = new DOMParserFactory();
      document = dpf.getDocument();

      Element root = dpf.newElementNode(document, "XPSRevisionControl");
      document.appendChild(root);

    }
View Full Code Here

        if ("save".equals(reqType) || "checkin".equals(reqType)) {
            getLogger().debug(".act(): Write to temp file: " + tempFile);

            try {
                Element contentNode = (Element) data.getFirstChild();
                DOMParserFactory dpf = new DOMParserFactory();

                // Create a new document, where the actual content starts at the root element, which is the inner part of requestDoc
                Document contentDocument = dpf.getDocument();
                contentDocument.appendChild(
                    (Element) dpf.cloneNode(contentDocument, contentNode, true));
                new DOMWriter(new FileOutputStream(tempFile)).printWithoutFormatting(
                    contentDocument);
            } catch (Exception e) {
                getLogger().error(".act(): Exception during writing to temp file", e);
            }
View Full Code Here

TOP

Related Classes of org.apache.lenya.xml.DOMParserFactory

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.