Examples of selectSingleElement()


Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath.selectSingleElement()

     */
    public void testSelectElementNode() throws Exception {

        ODOMXPath xpath = new ODOMXPath("cd[1]");
        // select the first cd element
        Element element = xpath.selectSingleElement(root);

        // ensure the node is not null
        assertNotNull("node selected was null", element);

        // check the name of the element
View Full Code Here

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath.selectSingleElement()

        // xpath to an attribute
        ODOMXPath xpath = new ODOMXPath("cd[1]/@country");

        try {
            // select the xpath. We expect an element
            xpath.selectSingleElement(root);
            fail("Expected an excpetion as xpath is to an attribute");
        } catch (XPathException e) {
            // expected
        }
    }
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                append(":").
                append(DeviceRepositorySchemaConstants.POLICY_ELEMENT_NAME);

        XPath policyXPath = new XPath(xpathString.toString(), new Namespace [] {
            MCSNamespace.DEVICE_DEFINITIONS });
        Element policy = policyXPath.selectSingleElement(invalidElement);

        if (policy == null) {
            throw new XPathException("Selected element was null for xPath: " +
                    invalidElement.toString());
        }
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                append(":").
                append(DeviceRepositorySchemaConstants.CATEGORY_ELEMENT_NAME);

        XPath categoryXPath = new XPath(xpathString.toString(),
                new Namespace [] { MCSNamespace.DEVICE_DEFINITIONS });
        Element category = categoryXPath.selectSingleElement(policy);

        String categoryName =
                category.getAttributeValue(DeviceRepositorySchemaConstants.
                CATEGORY_NAME_ATTRIBUTE);
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                POLICIES_ELEMENT_NAME);
        XPath policiesXPath = new XPath(xPathBuffer.toString(),
                new Namespace[]{MCSNamespace.DEVICE});

        try {
            Element policies = policiesXPath.
                    selectSingleElement(masterDevice);
            composition.addDefaultPolicyValue(policies, policyName, type,
                    context.getODOMFactory(),
                    context.getDeviceRepositoryAccessorManager());
        } catch (XPathException e) {
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

            final Element definitionsRoot = context.
                    getDeviceRepositoryAccessorManager().
                    getDeviceDefinitionsDocument().getRootElement();
            // Retrieve the new policy element.
            newPolicyElement =
                    newPolicyXPath.selectSingleElement(definitionsRoot);
        } catch (XPathException e) {
            EclipseCommonPlugin.handleError(ABPlugin.getDefault(), e);
        }

        TreeViewer treeViewer = categoriesComposite.getTreeViewer();
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                            path.getNamespacesString());
                }

                try {
                    // Get the equivalent element
                    equivalent = path.selectSingleElement(clone);
                } catch (XPathException e) {
                    throw new UndeclaredThrowableException(e);
                }
            }
        }
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                    POLICY_NAME_ATTRIBUTE).append("=\"").append(policyName).
                    append("\"]");
            XPath policyXPath = new XPath(xPathBuffer.toString(),
                    new Namespace[]{MCSNamespace.DEVICE_DEFINITIONS});
            Element policyElement =
                    policyXPath.selectSingleElement(getDeviceDefinitionsDocument().
                    getRootElement());

            if (policyElement == null) {
                throw new IllegalArgumentException("Could not find policy " +
                        policyName);
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

                    DEVICE_NAME_ATTRIBUTE).append("=\"").append(retrieveRootDeviceName()).
                    append("\"]");
            XPath masterXPath = new XPath(xPathBuffer.toString(),
                    new Namespace[]{MCSNamespace.DEVICE_HIERARCHY});
            Element masterElement =
                    masterXPath.selectSingleElement(getDeviceHierarchyDocument().
                    getRootElement());

            // Iterate over all the devices in the repository and remove the
            // policy from any device that includes it.
            removePolicyFromDeviceHierarchical(masterElement, policyName);
View Full Code Here

Examples of com.volantis.mcs.xml.xpath.XPath.selectSingleElement()

        Namespace[] namespaces = new Namespace[]{
            Namespace.getNamespace("ns", rootElement.getNamespaceURI())
        };
        XPath xpath = new XPath(buffer.toString(), namespaces);
        try {
            policyTypeElement = xpath.selectSingleElement(rootElement);
            // see if the type element has a "ref" attribute
            if (policyTypeElement != null) {
                String ref = policyTypeElement.getAttributeValue(
                        DeviceRepositorySchemaConstants.
                        POLICY_DEFINITION_REF_ATTRIBUTE_NAME);
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.