Package org.apache.commons.jxpath.ri.model.dom

Examples of org.apache.commons.jxpath.ri.model.dom.DOMNodePointer


      exclusionPatternList.add(pattern);
    }
    initTransformationPipelines();
    bookmarkProcessor = new BookmarkProcessor();   
    for (Iterator it = resolveIteratePointers("autoBookmark"); it.hasNext();) {
      DOMNodePointer pointer = (DOMNodePointer) it.next();
      Element elem = (Element) pointer.getBaseValue();
      String regexp = elem.getAttribute("uriPattern");
      String value = DOMUtil.getText(elem);
      bookmarkProcessor.addBookmark(regexp, value);
    }
  }
View Full Code Here


    convert.convertInfo();
    }
 
  private void convertInfo() {
    for (Iterator it = ctx.iteratePointers("//info/title"); it.hasNext();) {
      DOMNodePointer p = (DOMNodePointer) it.next();
      Element title = (Element) p.getBaseValue();
      Element newTitle = document.createElementNS(NamespaceURI.DUBLIN_CORE, "dc:title");
      newTitle.appendChild(document.createTextNode(DOMUtil.getText(title)));
      Element info = (Element) title.getParentNode();
      info.insertBefore(newTitle, title);
      info.removeChild(title);
    }
    for (Iterator it = ctx.iteratePointers("//info/description"); it.hasNext();) {
      DOMNodePointer p = (DOMNodePointer) it.next();
      Element description = (Element) p.getBaseValue();
      Element newDescription = document.createElementNS(NamespaceURI.DUBLIN_CORE, "dc:description");
      newDescription.appendChild(document.createTextNode(DOMUtil.getText(description)));
      Element info = (Element) description.getParentNode();
      info.insertBefore(newDescription, description);
      info.removeChild(description);
    }
    for (Iterator it = ctx.iteratePointers("//site/description|//feed/description"); it.hasNext(); ) {
      DOMNodePointer p = (DOMNodePointer) it.next();
      Element description = (Element) p.getBaseValue();
      Element parent = (Element) description.getParentNode();
      Element newDescription = document.createElementNS(NamespaceURI.DUBLIN_CORE, "dc:description");
      newDescription.appendChild(document.createTextNode(DOMUtil.getText(description)));
      parent.removeChild(description);
      Element info = document.createElement("info");
View Full Code Here

    ctx.removeAll("//info/date");
  }
   
    private void convertReferrer() {
    for (Iterator it = ctx.iteratePointers("//site|//feed|//template"); it.hasNext();) {
      DOMNodePointer p = (DOMNodePointer) it.next();
      Element elem = (Element) p.getBaseValue();
      if (elem.hasAttribute("referrer")) {
        if (!elem.getNodeName().equals("template")) {
          Element uri = (Element)elem.getElementsByTagName("uri").item(0);
          uri.setAttribute("referrer", elem.getAttribute("referrer"));         
        }
View Full Code Here

        }
    }

    private void convertURIPatterns() {
        for (Iterator it = ctx.iteratePointers("//site|//feed|//template"); it.hasNext();) {
            DOMNodePointer p = (DOMNodePointer) it.next();
            Element elem = (Element) p.getBaseValue();
            Element uriPatterns = document.createElement("uriPatterns");
            Element include = null;
            NodeList nodeList = elem.getElementsByTagName("include");
            if (nodeList.getLength() > 0) {
                include = (Element) nodeList.item(0);
                JXPathContext ctx = JXPathContext.newContext(include);
                for (Iterator it2 = ctx.iteratePointers("pattern"); it2.hasNext();) {
                    DOMNodePointer p2 = (DOMNodePointer) it2.next();
                    Element pattern = (Element) p2.getBaseValue();
                    Element newInclude = document.createElement("include");
                    newInclude.appendChild(document.createTextNode(DOMUtil.getText(pattern)));
                    uriPatterns.appendChild(newInclude);
                }
            }
            Element exclude = null;
            nodeList = elem.getElementsByTagName("exclude");
            if (nodeList.getLength() > 0) {
                exclude = (Element) nodeList.item(0);
                JXPathContext ctx = JXPathContext.newContext(exclude);
                for (Iterator it2 = ctx.iteratePointers("pattern"); it2.hasNext();) {
                    DOMNodePointer p2 = (DOMNodePointer) it2.next();
                    Element pattern = (Element) p2.getBaseValue();
                    Element newExclude = document.createElement("exclude");
                    newExclude.appendChild(document.createTextNode(DOMUtil.getText(pattern)));
                    uriPatterns.appendChild(newExclude);
                }
            }
View Full Code Here

        }
    }

    private void convertXSL() {
        for (Iterator it = ctx.iteratePointers("//transform"); it.hasNext();) {
            DOMNodePointer p = (DOMNodePointer) it.next();
            Element transform = (Element) p.getBaseValue();
      transform.setAttribute("uriPattern", transform.getAttribute("pattern"));
      transform.removeAttribute("pattern");
            NodeList nodeList = transform.getElementsByTagName("xsl");
            for (int i = 0, n = nodeList.getLength(); i < n; i++) {
              Element xsl = (Element)nodeList.item(0);
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.ri.model.dom.DOMNodePointer

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.