Examples of ODOMXPath


Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

            // Use a create xpath instead of just setAttribute on the
            // target as only the former method creates (or ensures is
            // created) the "whole path" from source to target (e.g. if
            // latter is grandchild)
            // NOTE that this is ok even where sourceToTargetPath==null
            final ODOMXPath createPath =
                        new ODOMXPath(sourceToTargetPath, newAttribute);

            // This just creates an EMPTY attribute.......
            final ODOMAttribute createdAttribute =
                        (ODOMAttribute) createPath.
                        create(sourceElement, odomFactory);

            // ....but in doing so it might have created us a new target:
            // first check whether it was originally null
            if (targetElement == null) {
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

            // Use a remove xpath instead of just removeAttribute on the
            // target as only the former method removes the "whole path"
            // from source to target (e.g. if latter is grandchild)
            // NOTE: This should still be ok if sourceToTargetPath==null
            final ODOMXPath deletePath =
                        new ODOMXPath(sourceToTargetPath, existingAttribute);

            // Now delete the attribute
            deletePath.remove(sourceElement);

            // We know that the original target was non-null, because it
            // contained the attribute: now find out whether the above
            // xpath delete also deleted the target (which it would if
            // it had been left empty)
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

        // Assume the the data on the item is the Element.
        Element element = (Element) item.getData();
        if (element != null) {
            // Look for problem markers associated with this element
            // from which to obtain the tool tip text.
            XPath xPath = new ODOMXPath(element);
            try {
                IMarker markers [] = PolicyUtils.findProblemMarkers(resource,
                        xPath);
                if (markers.length > 0) {
                    toolTipText = (String) markers[0].
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a Attribute node.
     */
    public void testRemoveAttribute() throws Exception {
        ODOMXPath path = new ODOMXPath("cd/@country");

        ODOMObservable removed = path.remove((ODOMObservable) root);

        assertNotNull("Removed element should exist", removed);
        assertTrue("Should be an Attribute", removed instanceof Attribute);
        Attribute attribute = (Attribute) removed;
        assertEquals("Name should match", "country", attribute.getName());
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a Text node.
     */
    public void testRemoveText() throws Exception {
        ODOMXPath path = new ODOMXPath("cd/title/text()");

        ODOMObservable removed = path.remove((ODOMObservable) root);

        assertNotNull("Removed element should exist", removed);
        assertTrue("Should be a Text node", removed instanceof Text);
        Text element = (Text) removed;
        assertEquals("Value should match", "Empire Burlesque",
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a node that doesn't exist.
     */
    public void testRemoveNodeUnknown() throws Exception {
        ODOMXPath path = new ODOMXPath("cd/@nocountry");

        ODOMObservable removed = path.remove((ODOMObservable) root);
        assertNull("Removed element should not exist", removed);
    }
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a node with an invalid context.
     */
    public void testRemoveInvalidContext() throws Exception {
        ODOMXPath path = new ODOMXPath("title");

        ODOMObservable removed = path.remove((ODOMObservable) root);
        assertNull("Removed element should not exist", removed);
    }
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a node which results in parent nodes being removed.
     */
    public void testRemoveParentNodesParentHasContent() throws Exception {
        ODOMXPath path = new ODOMXPath("cd/title/@testAttribute");

        ODOMObservable removed = path.remove((ODOMObservable) root);
        assertNotNull("Removed element should exist", removed);
        assertTrue("Should be an Attribute: " + removed,
                   removed instanceof Attribute);
        Attribute attribute = (Attribute) removed;
        assertEquals("Name should match", "testAttribute",
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

    /**
     * Test the removal of a node which results in parent nodes being removed.
     */
    public void testRemoveParentNodes() throws Exception {
        ODOMXPath path = new ODOMXPath("cd/price/@testRemove");

        ODOMObservable removed = path.remove((ODOMObservable) root);
        assertNotNull("Removed element should exist", removed);
        assertTrue("Should be an Element: " + removed,
                   removed instanceof Element);
        Element element = (Element) removed;
        assertEquals("Name should match", "price", element.getName());
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath

        one.addContent(two);
        two.addContent(three);
        three.setAttribute(threeAttrib);

        ODOMXPath oneToThree = new ODOMXPath("two/three");
        ODOMXPath oneToThreeAttrib = new ODOMXPath(oneToThree,
                                           "@" + threeAttrib.getName());

        // Do the removal.
        ODOMObservable observable = oneToThreeAttrib.remove(one);

        assertNotNull("Node shouldn't be null", observable);
        assertTrue("Type should match", observable instanceof ODOMElement);
        ODOMElement element = (ODOMElement) observable;
        assertEquals("Name should match", "two", element.getName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.