Package com.btaz.datautil.xml.model

Examples of com.btaz.datautil.xml.model.Element


                } else if(o1 instanceof Content && o2 instanceof Element) {
                    return 1;
                } else {
                    assert o1 instanceof Element;
                    assert o2 instanceof Element;
                    Element e1 = (Element) o1;
                    Element e2 = (Element) o2;
                    return e1.toString(true, true).compareTo(e2.toString(true, true));
                }
            }
        });
    }
View Full Code Here


            String textB = ((Content)b).getText();
            if(! textA.equals(textB)) {
                return new Difference(a, b, "Content is different");
            }
        } else if (a instanceof Element && b instanceof Element) {
            Element ea = (Element)a;
            Element eb = (Element)b;

            // - element name
            if(! ea.getName().equals(eb.getName())) {
                return new Difference(a, b, "Element names are different");
            }

            // - attributes names
            if(! ea.getAttributeNames().equals(eb.getAttributeNames())) {
                return new Difference(a, b, "Element attribute names are different");
            }

            // - attributes values
            for(int i=0; i<ea.getAttributeNames().size(); i++) {
                if(! ea.attributeValue(ea.getAttributeNames().get(i))
                        .equals(eb.attributeValue(eb.getAttributeNames().get(i)))) {
                    return new Difference(a, b, "Element attribute values are different");
                }
            }

            // - element type
            if(ea.isEmptyElementTag() != eb.isEmptyElementTag()) {
                return new Difference(a, b, "Empty element tags are different");
            }
        } else {
            return new Difference(a, b, "The nodes are different");
        }
View Full Code Here

        if(node instanceof Content) {
            return;
        }

        // is Element node
        Element element = (Element) node;
        MatchType matchType = queryMatchers.get(level).match(level, element);
        if(matchType == MatchType.NOT_A_MATCH) {
            // no reason to scan deeper
            //noinspection UnnecessaryReturnStatement
            return;
        } else if(matchType == MatchType.NODE_MATCH) {
            // we have a match
            if(level == queryMatchers.size()-1) {
                // full path match
                collector.add(node);
            } else {
                // scan deeper
                List<Node> childElements = element.getChildElements();
                for (Node childElement : childElements) {
                    treeWalker(childElement, level+1, queryMatchers, collector);
                }
            }
        } else {
View Full Code Here

TOP

Related Classes of com.btaz.datautil.xml.model.Element

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.