Package com.volantis.mcs.xml.xpath

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


        // 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


        StringBuffer xpathBuffer = new StringBuffer();
        xpathBuffer.append("//").
                append(MCSNamespace.DEVICE_HIERARCHY.getPrefix()).
                append(':').
                append("device[@name]")//$NON-NLS-1$
        XPath xpath = new XPath(xpathBuffer.toString(),
                new Namespace[]{MCSNamespace.DEVICE_HIERARCHY});

        List matches = new ArrayList();

        try {
            // Apply the XPath expression to the root of the document provided
            List nodes = xpath.selectNodes(root);

            if (nodes != null) {
                // Iterate over any nodes selected by the XPath
                for (Iterator i = nodes.iterator(); i.hasNext(); /**/) {
                    Object current = i.next();
View Full Code Here

        StringBuffer xpathBuffer = new StringBuffer();
        xpathBuffer.append("//").
                append(MCSNamespace.DEVICE_IDENTIFICATION.getPrefix()).
                append(':').
                append(DeviceRepositorySchemaConstants.DEVICE_ELEMENT_NAME);
        XPath xpath = new XPath(xpathBuffer.toString(),
                new Namespace[]{MCSNamespace.DEVICE_IDENTIFICATION});

        List matches = new ArrayList();

        try {
            // Apply the XPath expression to the root of the document provided
            List nodes = xpath.selectNodes(root);

            if (nodes != null) {
                // Iterate over the devices selected by the XPath. For each
                // device check its patterns agains the regular expression. If
                // there is a match then add the device to the list of matches.
View Full Code Here

                    errorReporter, min);
            BigDecimal maxDecimal = getBigDecimal(maxString, element,
                    errorReporter, max);
            if (minDecimal != null && maxDecimal != null &&
                    minDecimal.compareTo(maxDecimal) == 1) {
                ErrorDetails details = new ErrorDetails(element, new XPath(element),
                        null, FaultTypes.MIN_RANGE_MORE_THAN_MAX, null, null);
                errorReporter.reportError(details);
            }
        }
    }
View Full Code Here

            ErrorReporter errorReporter, Attribute attribute) {
        BigDecimal result = null;
        try {
            result = new BigDecimal(value);
        } catch (NumberFormatException e) {
            ErrorDetails details = new ErrorDetails(element, new XPath(attribute),
                    null, FaultTypes.NOT_A_NUMBER, value, null);
            errorReporter.reportError(details);
        }
        return result;
    }
View Full Code Here

            ODOMElement sourceElement = elements[0];
            ODOMElement targetElement = getCurrentTarget(event);
            if (targetElement == sourceElement) {
                event.detail = DND.DROP_NONE;
            } else {
                XPath srcXPath = new XPath(actionDetails.getElement(0));
                boolean canReplace = ActionSupport.canReplace(sourceElement,
                        targetElement, srcXPath);
                if (!targetElement.getName().
                        equals(FormatType.EMPTY.getElementName())) {
                    boolean canSwap = event.detail == DND.DROP_MOVE;
View Full Code Here

        xPathString.append("ancestor-or-self::").
                append(namespace.getPrefix()).
                append(":").
                append(DeviceRepositorySchemaConstants.DEVICE_ELEMENT_NAME);

        XPath deviceXPath = new XPath(xPathString.toString(), new Namespace[]{
                namespace});
        Element device = deviceXPath.selectSingleElement(invalidElement);

        if (device == null) {
            throw new XPathException(
                    "Device element was null when selected based on element: " +
                            invalidElement.toString());
View Full Code Here

        xpathString.append("ancestor-or-self::").
                append(MCSNamespace.DEVICE.getPrefix()).
                append(":").
                append(DeviceRepositorySchemaConstants.POLICY_ELEMENT_NAME);

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

        if (policy == null) {
            throw new XPathException(
                    "Selected element was null when selected based on element: " +
                            invalidElement.toString());
View Full Code Here

                            POLICY_DEFINITION_STRUCTURE_ELEMENT_NAME)
                  .append("/ns:")
                  .append(DeviceRepositorySchemaConstants.
                            POLICY_DEFINITION_FIELD_ELEMENT_NAME);
        // create an XPath that can be used to retrieve the field elements
        XPath xpath = new XPath(pathBuffer.toString(),
                                new Namespace[] {
                                    Namespace.getNamespace(
                                                "ns",
                                                typeElement.getNamespaceURI())
                                });

        try {
            List fields = xpath.selectNodes(typeElement);
            // we must have at least one field
            if (fields.isEmpty()) {
                throw new IllegalStateException("The structure element must " +
                                                "contain at least one field");
            }
View Full Code Here

        StringBuffer buffer =
                new StringBuffer(element.getNamespacePrefix().length() + 1 +
                rowElementName.length());
        buffer.append(element.getNamespacePrefix()).append(":").
                append(rowElementName);
        XPath rowsXPath = new XPath(buffer.toString(),
                new Namespace[]{element.getNamespace()});

        List gridRowFormats;
        try {
            gridRowFormats =
                    rowsXPath.selectNodes(element);
        } catch (XPathException e) {
            throw new UndeclaredThrowableException(e);
        }

        return gridRowFormats;
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.