Examples of NamespaceHelper


Examples of org.apache.lenya.xml.NamespaceHelper

     * Returns the Lenya meta data element.
     * @param doc The XML document.
     * @return A DOM element.
     */
    protected Element getMetaElement(org.w3c.dom.Document doc) throws DocumentException {
        NamespaceHelper namespaceHelper =
            new NamespaceHelper(PageEnvelope.NAMESPACE, PageEnvelope.DEFAULT_PREFIX, doc);
        Element documentElement = doc.getDocumentElement();
        Element metaElement = namespaceHelper.getFirstChild(documentElement, META);

        if (metaElement == null) {
            metaElement = namespaceHelper.createElement(META);
            Element[] children = DocumentHelper.getChildren(documentElement);
            if (children.length == 0) {
                documentElement.appendChild(metaElement);
            } else {
                documentElement.insertBefore(metaElement, children[0]);
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @see org.apache.lenya.cms.publication.CollectionImpl#getNamespaceHelper()
     */
    protected NamespaceHelper getNamespaceHelper() throws DocumentException,
            ParserConfigurationException, SAXException, IOException {

        NamespaceHelper helper = super.getNamespaceHelper();
        Element collectionElement = helper.getDocument().getDocumentElement();
        String namespaceDeclaration = collectionElement.getAttributeNS(
                    "http://www.w3.org/2000/xmlns/", "xlink");
        if (namespaceDeclaration == null || !namespaceDeclaration.equals(XLink.XLINK_NAMESPACE)) {
            collectionElement.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink",
                    XLink.XLINK_NAMESPACE);
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @param helper The namespace helper of the document.
     * @return An XML element.
     */
    public Element save(NamespaceHelper helper) {
        org.w3c.dom.Document document = helper.getDocument();
        NamespaceHelper taskHelper =
            new NamespaceHelper(Task.NAMESPACE, Task.DEFAULT_PREFIX, document);
        Element element = taskHelper.createElement(ELEMENT_TASK);
       
        List keys = new ArrayList(getParameters().keySet());
        Collections.sort(keys);

        for (Iterator i = keys.iterator(); i.hasNext();) {
            String key = (String) i.next();
            Element parameterElement = taskHelper.createElement(ELEMENT_PARAMETER);
            parameterElement.setAttribute(ATTRIBUTE_NAME, key);
            parameterElement.setAttribute(ATTRIBUTE_VALUE, (String) getParameters().get(key));
            element.appendChild(parameterElement);
        }

View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

            return;
        }

        // Create node
        NamespaceHelper helper = new NamespaceHelper(NAMESPACE_URI, "", document);
        Element child = helper.createElement(SiteTreeNodeImpl.NODE_NAME);
        child.setAttribute(SiteTreeNodeImpl.ID_ATTRIBUTE_NAME, id);
       
        if (visibleInNav) {
            child.setAttribute(SiteTreeNodeImpl.VISIBLEINNAV_ATTRIBUTE_NAME, "true");
        } else {
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @see org.apache.lenya.cms.publication.SiteTree#getTopNodes()
     */
    public SiteTreeNode[] getTopNodes() {
        List childElements = new ArrayList();

        NamespaceHelper helper = new NamespaceHelper(NAMESPACE_URI, "", document);
        Element[] elements = helper.getChildren(document.getDocumentElement(), SiteTreeNodeImpl.NODE_NAME);

        for (int i = 0; i < elements.length; i++) {
            SiteTreeNode newNode = new SiteTreeNodeImpl(elements[i], this);
            childElements.add(newNode);
        }
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * @exception SchedulerException if an error occurs
     */
    public Document getSnapshot(String[] jobGroupNames) throws SchedulerException {
        log.debug("Creating job snapshot");

        NamespaceHelper helper = SchedulerStore.getNamespaceHelper();
        Document document = helper.getDocument();
        Element root = document.getDocumentElement();

        // print a list of all available trigger types
        root.appendChild(getTriggerTypes(helper));

View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

            //dumpLuceneDocument(file, documentWriter);

            DocumentBuilder builder = DocumentHelper.createBuilder();
            org.w3c.dom.Document luceneDocument = builder.parse(new InputSource(new StringReader(documentWriter.toString())));

            NamespaceHelper helper = new NamespaceHelper(LUCENE_NAMESPACE, "luc", luceneDocument);
            Element root = luceneDocument.getDocumentElement();
            Element[] fieldElements = helper.getChildren(root, "field");

            Document document = super.getDocument(file, htdocsDumpDir);

            Class[] parameterTypes = { String.class, String.class };
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

        ModifiableSource metaSource = null;
        try {
            metaSource = (ModifiableSource) resolver.resolveURI(publicationsUri + "/"
                    + newPublicationId + "/" + CONFIGURATION_FILE);
            Document metaDoc = DocumentHelper.readDocument(metaSource.getInputStream());
            NamespaceHelper helper = new NamespaceHelper(CONFIGURATION_NAMESPACE, "", metaDoc);
            Element nameElement = helper.getFirstChild(metaDoc.getDocumentElement(), ELEMENT_NAME);
            DocumentHelper.setSimpleElementText(nameElement, name);

            save(metaDoc, metaSource);
        } finally {
            if (resolver != null) {
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

     * Loads the collection from its XML source.
     */
    protected final void load() {
        if (!this.isLoaded) {
            getLogger().debug("Loading: ");
            NamespaceHelper helper;
            try {
                helper = getNamespaceHelper();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
View Full Code Here

Examples of org.apache.lenya.xml.NamespaceHelper

    /**
     * Saves the collection.
     */
    public final void save() {
        try {
            NamespaceHelper helper = getNamespaceHelper();
            saveXml(helper);
            DocumentHelper.writeDocument(helper.getDocument(), getDelegate().getOutputStream());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.