Package org.jaxen.jdom

Examples of org.jaxen.jdom.JDOMXPath.selectNodes()


    public void concatOccurrence(Object xmlDoc, String xpath, String concatSep, Appendable chaineConcat) throws IOException {

        try {
            JDOMXPath xp = new JDOMXPath(xpath);
            List ls = xp.selectNodes(xmlDoc);
            Iterator i = ls.iterator();
            int j = 0;
            while (i.hasNext()) {
                j++;
                String text = "";
View Full Code Here


            JDOMXPath xp = new JDOMXPath(xpath);
            SimpleNamespaceContext context = new SimpleNamespaceContext();
            context.addNamespace("dc", "http://purl.org/dc/elements/1.1/");
            context.addNamespace("meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0");
            xp.setNamespaceContext(context);
            List selectNodes = xp.selectNodes(xmlDoc);
            Iterator nodes = selectNodes.iterator();
            while (nodes.hasNext()) {
                Object node = nodes.next();
                if (node instanceof Element) {
                    Element elem = (Element) node;
View Full Code Here

    // XXX this is expensive for very large documents. In those cases another
    // XXX method (direct processing of SAX events, or XMLPull) should be used.
    XPath path = new JDOMXPath("//text:span | //text:p | //text:tab | //text:tab-stop | //text:a");
    path.addNamespace("text", root.getNamespace("text").getURI());
    Namespace xlink = Namespace.getNamespace("xlink", "http://www.w3.org/1999/xlink");
    List list = path.selectNodes(doc);
    boolean lastp = true;
    for (int i = 0; i < list.size(); i++) {
      Element el = (Element)list.get(i);
      String text = el.getText();
      if (el.getName().equals("p")) {
View Full Code Here

    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(fis);
    XPath path = new JDOMXPath("/office:document-meta/office:meta/*");
    Element root = doc.getRootElement();
    path.addNamespace("office", root.getNamespace("office").getURI());
    List list = path.selectNodes(doc);
    for (int i = 0; i < list.size(); i++) {
      Element n = (Element)list.get(i);
      String text = n.getText();
      if (text.trim().equals("")) continue;
      String name = n.getName();
View Full Code Here

      // Add all namespaces
      for (String key : namespaces.keySet()) {
        Namespace value = namespaces.get(key);
        xpath.addNamespace(key, value.getURI());
      }
      return xpath.selectNodes(element);
  }

  /**
   * This method transforms the xml log using a xslt file and opens a new window with the output file
   *
 
View Full Code Here

    // XXX this is expensive for very large documents. In those cases another
    // XXX method (direct processing of SAX events, or XMLPull) should be used.
    XPath path = new JDOMXPath("//text:span | //text:p | //text:tab | //text:tab-stop | //text:a");
    path.addNamespace("text", root.getNamespace("text").getURI());
    Namespace xlink = Namespace.getNamespace("xlink", "http://www.w3.org/1999/xlink");
    List list = path.selectNodes(doc);
    boolean lastp = true;
    for (int i = 0; i < list.size(); i++) {
      Element el = (Element)list.get(i);
      String text = el.getText();
      if (el.getName().equals("p")) {
View Full Code Here

    SAXBuilder builder = new SAXBuilder();
    Document doc = builder.build(fis);
    XPath path = new JDOMXPath("/office:document-meta/office:meta/*");
    Element root = doc.getRootElement();
    path.addNamespace("office", root.getNamespace("office").getURI());
    List list = path.selectNodes(doc);
    for (int i = 0; i < list.size(); i++) {
      Element n = (Element)list.get(i);
      String text = n.getText();
      if (text.trim().equals("")) continue;
      String name = n.getName();
View Full Code Here

        Namespace namespace = Namespace.getNamespace (XPDLUtil.XPDL_NS);
        // cut out the WorkflowProcess nodes
        XPath path = new JDOMXPath
            ("/xpdl:Package/xpdl:WorkflowProcesses/xpdl:WorkflowProcess");
        path.addNamespace("xpdl", XPDLUtil.XPDL_NS);
        Iterator processListIterator = path.selectNodes(doc).iterator();
        while (processListIterator.hasNext()) {
            Element child = (Element)processListIterator.next();
            processes.add(child);
        }
        if (processes.size() == 0) {
View Full Code Here

           
            Document doc = builder.build( args[0] );
           
            XPath xpath = new JDOMXPath( args[1] );
           
            List results = xpath.selectNodes( doc );
           
            Iterator resultIter = results.iterator();

            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
View Full Code Here

           
            Document doc = builder.build( args[0] );
           
            XPath xpath = new JDOMXPath( args[1] );
           
            List results = xpath.selectNodes( doc );
           
            Iterator resultIter = results.iterator();

            System.out.println("Document :: " + args[0] );
            System.out.println("   XPath :: " + args[1] );
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.