Package com.volantis.mcs.xml.xpath

Examples of com.volantis.mcs.xml.xpath.XPath


        String filter[] = {"name1", "name2"};
        ODOMSelectionFilter filter1;
        ODOMSelectionFilter filter2;
        ODOMSelectionFilter filter3;

        filter1 = new ODOMSelectionFilter(new XPath("."), filter);
        filter2 = new ODOMSelectionFilter(new XPath("."), filter);
        filter3 = new ODOMSelectionFilter(new XPath("catalog"), filter);

        assertEquals("Hashcode should match", filter1.hashCode(),
                filter2.hashCode());
        // Thanks to synergetics fudge of the assertXXX methods I have to use
        // the assertTrue here.
View Full Code Here


     */
    public List getChangedElements(Document document) throws XPathException {
        List result = new ArrayList(changedNodesXPaths.size());

        for (int i = 0; i < changedNodesXPaths.size(); i++) {
            XPath xPath = (XPath) changedNodesXPaths.get(i);

            while (xPath != null) {
                ODOMObservable o = (ODOMObservable) xPath.selectSingleNode(
                        document);

                if (o != null) {
                    if (o instanceof ODOMElement) {
                        result.add(o);
                    } else {
                        result.add(o.getParent());
                    }
                    break; //exit while loop
                } else {
                    xPath = xPath.getParent();
                }
            }

        }

View Full Code Here

        ListIterator li = changeEvents.listIterator(changeEvents.size());
        List xpaths = Collections.EMPTY_LIST;

        while (li.hasPrevious()) {
            ODOMChangeEvent changeEvent = (ODOMChangeEvent) li.previous();
            XPath xpath = changeEvent.undo();
            xpaths = addIfNotNullAndNotAlreadyContained(xpath, xpaths);
        }

        return new UndoRedoInfo(xpaths, undoRedoMemento);
    }
View Full Code Here

        ListIterator li = changeEvents.listIterator();
        List xpaths = Collections.EMPTY_LIST;

        while (li.hasNext()) {
            ODOMChangeEvent changeEvent = (ODOMChangeEvent) li.next();
            XPath xpath = changeEvent.redo();
            xpaths = addIfNotNullAndNotAlreadyContained(xpath, xpaths);
        }
        return new UndoRedoInfo(xpaths, undoRedoMemento);
    }
View Full Code Here

        assertEquals("Too many events", 1, eventCount);
    }

    public void testUpdateWithResolver() throws Exception {
        ODOMSelectionFilter filter = new ODOMSelectionFilter(
                new XPath("ancestor-or-self::family"),
                null);
        ODOMElementSelectionProvider provider =
                new DefaultODOMElementSelectionProvider(filter);

        Element root = factory.element("families");
View Full Code Here

        Namespace namespace[] = new Namespace[]{getNamespace()};

        while (childIterator.hasNext()) {
            ODOMElement child = (ODOMElement) childIterator.next();
            // Get the relative XPath of the child.
            XPath childXPath = new XPath((Element) child, namespace);

            try {
                // Does the relative path find an element in the toElement?
                ODOMElement toChild = (ODOMElement)
                        childXPath.selectSingleNode((Element) toElement);

                if (toChild != null) {
                    // Corresponding child also exists in the source element,
                    // so recursively move listeners between the two children.
                    child.moveListeners(toChild);
View Full Code Here

                            append(PREFIX).append(':');
                }
            }
        }

        XPath xPath = new XPath(xPathBuffer.toString(),
                new Namespace[] { MCSNamespace.LPDM });
        ODOMSelectionFilter filter = new ODOMSelectionFilter(xPath,
                new String[]{policyElementName});

        return filter;
View Full Code Here

            throw new IllegalArgumentException(
                    "Validation requires the root node of the DOM (sub-)tree to " +
                            "be validated");
        }
        this.root = root;
        this.rootXPath = new XPath(root);
    }
View Full Code Here

     *
     * @return the XPath that identifies the current location in the sax
     *         event stream.
     */
    private XPath getCurrentXPath() {
        XPath currentPath = tracker.currentXPath();
        if (currentPath == null) {
            currentPath = rootXPath;
        } else {
            currentPath = new XPath(rootXPath, currentPath);
        }
        return currentPath;
    }
View Full Code Here

        // to report
        if (pendingErrors != null) {
            // iterate of the pending errors reporting each one via the
            // ErrorReporter

            XPath currentPath = getCurrentXPath();
            try {
                for (int i = 0; i < pendingErrors.size(); i++) {
                    String errorMessage = (String) pendingErrors.get(i);

                    ErrorDetails details =
View Full Code Here

TOP

Related Classes of com.volantis.mcs.xml.xpath.XPath

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.