Package xbird.xquery.dm.value.node

Examples of xbird.xquery.dm.value.node.DMElement


    private static boolean attributesEqual(XQNode n1, XQNode n2, Collator collator) {
        assert (n1.nodeKind() == NodeKind.ELEMENT && n2.nodeKind() == NodeKind.ELEMENT);
        if(n1 instanceof DMElement) {
            assert (n2 instanceof DMElement);
            DMElement e1 = (DMElement) n1, e2 = (DMElement) n2;
            Iterator<DMAttribute> a1Itor = e1.attribute().iterator();
            Iterator<DMAttribute> a2Itor = e2.attribute().iterator();
            while(a1Itor.hasNext()) {
                if(!a2Itor.hasNext()) {
                    return false;
                }
                DMAttribute a1 = a1Itor.next();
                DMAttribute a2 = a2Itor.next();
                QualifiedName a1name = a1.nodeName();
                QualifiedName a2name = a2.nodeName();
                if(!a1name.equals(a2name)) {
                    return false;
                }
                String a1val = a1.getContent();
                String a2val = a2.getContent();
                assert (a1val != null);
                if(collator != null) {
                    if(!collator.equals(a1val, a2val)) {
                        return false;
                    }
                } else {
                    if(!a1val.equals(a2val)) {
                        return false;
                    }
                }
            }
        } else {
            // TODO performance improvement!
            assert (n1 instanceof DTMElement && n2 instanceof DTMElement);
            DTMElement e1 = (DTMElement) n1, e2 = (DTMElement) n2;
            DTMAttribute att1 = null;
            for(int i = 0; (att1 = e1.attribute(i)) != null; i++) {
                DTMAttribute att2 = e2.attribute(i);
                if(!att1.nodeName().equals(att2.nodeName())) {
                    return false;
                }
                final String att1val = att1.getContent();
View Full Code Here


                break;
            }
            byte nodekind = curNode.nodeKind();
            if(nodekind == NodeKind.ELEMENT) {
                if(curNode instanceof DMElement) {
                    DMElement e = ((DMElement) curNode);
                    if(!byIDRef) {
                        if(e.isId()) {
                            // The is-id property of the element node is true, and the typed value
                            // of the element node is equal to V under the rules of the eq operator
                            // using the Unicode code point collation.
                            //String val = e.typedValue().stringValue();
                            String val = e.stringValue();
                            if(id.equals(val)) {
                                nodes.add(e);
                            }
                            continue;
                        }
                    } else {
                        if(e.isIdrefs()) {
                            //String val = e.typedValue().stringValue();
                            String val = e.stringValue();
                            if(id.equals(val)) {
                                nodes.add(e);
                            }
                            continue;
                        }
                    }
                    DMAttribute idatt = e.getAttribute(XMLConstants.XML_NS_URI, "id");
                    if(idatt != null && id.equals(idatt.getContent())) {
                        nodes.add(e);
                    }
                } else {
                    assert (curNode instanceof DTMElement);
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.node.DMElement

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.