Package net.sourceforge.nanoxml

Examples of net.sourceforge.nanoxml.XMLElement


     * @return
     * @throws XMLParseException
     * @throws IOException
     */
    public RunResult parse(Reader r) throws XMLParseException, IOException {
        XMLElement xmlRun = new XMLElement();
        BufferedReader reader = null;
       
        try {
            reader = new BufferedReader(r);
            xmlRun.parseFromReader(reader);
   
            checkTag(xmlRun, RUN_RESULT);
           
            String attr;
            RunResult run = new RunResult(getValue(xmlRun, RUN_NAME, ""));
           
            for (Enumeration enumPkg = xmlRun.enumerateChildren(); enumPkg.hasMoreElements(); ) {
                XMLElement xmlPkg = (XMLElement) enumPkg.nextElement();
                int indexTag = checkTag(xmlPkg, new String[]{PACKAGE_RESULT, PROPERTY});
               
                if (indexTag == 1) {
                    String name  = getValue(xmlPkg, PROPERTY_NAME, "");
                    String value  = getValue(xmlPkg, PROPERTY_VALUE, "");
                    run.setSystemProperty(name, value);
                    continue;
                }
               
                attr = getValue(xmlPkg, PACKAGE_NAME, "");
                PackageResult pkg = new PackageResult(attr);            
                run.add(pkg);
               
                for (Enumeration enumCls = xmlPkg.enumerateChildren(); enumCls.hasMoreElements(); ) {
                    XMLElement xmlCls = (XMLElement) enumCls.nextElement();
                    checkTag(xmlCls, CLASS_RESULT);
                   
                    attr = getValue(xmlCls, CLASS_NAME, "");
                    ClassResult cls = new ClassResult(attr);
                    pkg.add(cls);
                   
                    for (Enumeration enumTest = xmlCls.enumerateChildren(); enumTest.hasMoreElements(); ) {
                        XMLElement xmlTest = (XMLElement) enumTest.nextElement();
                        checkTag(xmlTest, TEST_RESULT);
                       
                        attr = getValue(xmlTest, TEST_NAME, "");
                        TestResult test = new TestResult(attr);
                        cls.add(test);
                       
                        for (Enumeration enumCheck = xmlTest.enumerateChildren(); enumCheck.hasMoreElements(); ) {
                            XMLElement xmlCheck = (XMLElement) enumCheck.nextElement();
                            if (TEST_ERROR.equals(xmlCheck.getName())) {
                                test.setFailedMessage(xmlCheck.getContent());
                            } else {
                                checkTag(xmlCheck, CHECK_RESULT);
                               
                                test.add(createCheck(xmlCheck));
                            }
View Full Code Here


        attr = getValue(xmlCheck, CHECK_ACTUAL, "");
        check.setActual(attr);
       
        // get the log if any
        if (xmlCheck.countChildren() > 0) {
            XMLElement firstChild = (XMLElement) xmlCheck.enumerateChildren().nextElement();
            checkTag(firstChild, CHECK_LOG);
           
            String content = firstChild.getContent();
            if (content != null) {
                check.appendToLog(attr);
            }
        }
   
View Full Code Here

TOP

Related Classes of net.sourceforge.nanoxml.XMLElement

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.