Package com.volantis.mcs.xml.xpath

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


                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

                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

            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

                            path.getNamespacesString());
                }

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

                    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

                    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

        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

                    buffer = new StringBuffer();
                    buffer.append("/ns:definitions/ns:types/ns:type[@name=\"")
                            .append(ref)
                            .append("\"]");
                    xpath = new XPath(buffer.toString(), namespaces);
                    policyTypeElement = xpath.selectSingleElement(rootElement);
                }
            }
        } catch (XPathException e) {
            // There was a problem retrieving the type element.
            throw new UndeclaredThrowableException(e, e.getMessage());
View Full Code Here

                                final Element hierarchyRoot = dram.
                                        getDeviceHierarchyDocument().
                                        getRootElement();

                                // Retrieve the new device element.
                                newDeviceElement = newDeviceXPath.
                                        selectSingleElement(hierarchyRoot);
                            } catch (XPathException e) {
                                EclipseCommonPlugin.
                                        handleError(ABPlugin.getDefault(), e);
                            }
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.