Package nu.xom

Examples of nu.xom.Elements


     
        File masterList = new File(canonical, "xmlconf");
        masterList = new File(masterList, "xmlconf.xml");
        if (masterList.exists()) {
            Document xmlconf = builder.build(masterList);
            Elements testcases = xmlconf.getRootElement().getChildElements("TESTCASES");
            processExclusiveTestCases(testcases);
        }

    }
View Full Code Here


    private void processExclusiveTestCases(Elements testcases)
      throws ParsingException, IOException {
       
        for (int i = 0; i < testcases.size(); i++) {
              Element testcase = testcases.get(i);
              Elements tests = testcase.getChildElements("TEST");
              processExclusiveTests(tests);
              Elements level2 = testcase.getChildElements("TESTCASES");
              // need to be recursive to handle recursive IBM test cases
              processExclusiveTestCases(level2);
        }
       
    }
View Full Code Here

        in.close();
        out.close();
        connection.disconnect();

        Element methodResponse = response.getRootElement();         
        Elements body = methodResponse.getChildElements();
        if (body.size() != 1) {
            System.err.println("XML-RPC format error");
            return;
        }
        if (body.get(0).getQualifiedName().equals("params")) {
            Element responseParam = body.get(0).getFirstChildElement("param");
            Element responseValue
              = responseParam.getFirstChildElement("value");
            Element responseDouble
              = responseValue.getFirstChildElement("double");       
            System.out.println(responseDouble.getValue());
        }
        else if (body.get(0).getQualifiedName().equals("fault")) {
            handleFault(body.get(0));
        }
        else {
            System.err.println("XML-RPC Format Error");
            return;  
        }
View Full Code Here

    private static void handleFault(Element fault) {
     
        Element value =  fault.getFirstChildElement("value");     
        Element struct = value.getFirstChildElement("struct");     
        Elements members = struct.getChildElements("member");     
        Element member1 =  members.get(0);     
        Element member2 =  members.get(1);     
        String code = "";
        String detail = "";
        Element name1 = member1.getFirstChildElement("name");
        Element value1 = member1.getFirstChildElement("value");
        Element name2 = member2.getFirstChildElement("name");
View Full Code Here

            for (int i = 0; i < element.getNamespaceDeclarationCount(); i++) {
                String prefix = element.getNamespacePrefix(i);
                element.removeNamespaceDeclaration(prefix)
            }

            Elements elements = element.getChildElements();     
            for (int i = 0; i < elements.size(); i++) {
              convert(elements.get(i));
            }
               
        }           
       
    }
View Full Code Here

 
  public static void listChildren(Element current, int depth) {
  
    printSpaces(depth);
    System.out.println(current.getQualifiedName());
    Elements children = current.getChildElements();
    for (int i = 0; i < children.size(); i++) {
      listChildren(children.get(i), depth+1);
    }
   
  }
View Full Code Here

              "plain&only_with_tag=HEAD"
            );
        }
        Document master = builder.build(baseURL.toExternalForm());
        Element testsuite = master.getRootElement();
        Elements testcases = testsuite.getChildElements("testcases");
        for (int i = 0; i < testcases.size(); i++) {
            Element group = testcases.get(i);  
            String basedir = group.getAttributeValue("basedir");
            if (basedir.startsWith("Harold")) {
                // These tests are listed in the catalog but haven't
                // yet been checked into CVS. besides, these are all
                // based on individual tests in this class anyway, so
                // running these is duplicated effort.
                continue;  
            }
            Elements cases = group.getChildElements("testcase");
            for (int j = 0; j < cases.size(); j++) {
                Element testcase = cases.get(j);
                String id = testcase.getAttributeValue("id");
                String features = testcase.getAttributeValue("features");
                if (features != null) {
                    if (features.indexOf("unexpanded-entities") >= 0) continue;
                    if (features.indexOf("unparsed-entities") >= 0) continue;
View Full Code Here

     
      // Parse the document
      Document document = parser.build(url);
      Element oldRoot = document.getRootElement();
      Element newRoot = new Element("linkset");
      Elements toplevel = oldRoot.getChildElements();
      for (int i = 0; i < toplevel.size(); i++) {
        Element element = toplevel.get(i);
        Element link = element.getFirstChildElement("link",
          "http://my.netscape.com/rdf/simple/0.9/");
        link.detach();
        newRoot.appendChild(link);
      }
View Full Code Here

            }
            catch (MalformedURLException ex) {
                // skip this one  
            }
        }
        Elements children = element.getChildElements();
        for (int i = 0; i < children.size(); i++) {
            search(children.get(i), base);
        }
       
    }
View Full Code Here

    private static int chapter = 0;
 
    public static void extract(Element element)
      throws IOException {       

        Elements elements = element.getChildElements();
        for (int i = 0; i < elements.size(); i++) {
            Element child = elements.get(i);
            if (child.getQualifiedName().equals("chapter")) {
                chapter++;
            }      
             if (child.getQualifiedName().equals("example")) {
                extractExample(child, chapter);
View Full Code Here

TOP

Related Classes of nu.xom.Elements

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.