Package org.apache.lenya.xml

Examples of org.apache.lenya.xml.DOMParserFactory


     * @throws IOException DOCUMENT ME!
     * @throws Exception DOCUMENT ME!
     */
    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 DOCUMENT ME!
     *
     * @throws Exception DOCUMENT ME!
     */
    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

        this.configurationFilePath = configurationFilePath;

        File configurationFile = new File(configurationFilePath);

        try {
            Document document = new DOMParserFactory().getDocument(configurationFilePath);
            configure(document.getDocumentElement());
        } catch (Exception e) {
            log.error("Cannot load publishing configuration! ", e);
        }
    }
View Full Code Here

            Date start = new Date();
           
            Indexer indexer = (Indexer) ie.getIndexerClass().newInstance();
           
            DOMUtil du = new DOMUtil();
            Document config = new DOMParserFactory().getDocument(argv[0]);
            indexer.configure(du.getElement(config.getDocumentElement(), new XPath("indexer")));
           
            if (create)
                indexer.createIndex(root, index);
            else
View Full Code Here

        // save to temporary file, if needed
        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

        this.configurationFilePath = configurationFilePath;

        File configurationFile = new File(configurationFilePath);

        try {
            Document document = new DOMParserFactory().getDocument(configurationFilePath);
            configure(document.getDocumentElement());
        } catch (Exception e) {
            log.error("Cannot load publishing configuration! ", e);
            System.err.println("Cannot load publishing configuration! " + e);
        }
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

                " 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

                " 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

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.