Package com.volantis.xml.namespace

Examples of com.volantis.xml.namespace.ExpandedName


        factory = ExpressionFactory.getDefaultInstance();
    }

    public void testGetName() throws Exception {
        ExpandedName name = new ImmutableExpandedName("uri://",
                                                      "fred");
        ExpandedName other = new MutableExpandedName("uri://",
                                                     "jim");
        Value value = new SimpleStringValue(factory, "hello");
        Variable nameVar = new SimpleVariable(factory,
                                              name,
                                              value);
View Full Code Here


        assertTrue("name for otherVar not immutable",
                   otherVar.getName() instanceof ImmutableExpandedName);
    }

    public void testGetValue() throws Exception {
        ExpandedName name = new ImmutableExpandedName("uri://",
                                                      "fred");
        ExpandedName other = new MutableExpandedName("uri://",
                                                     "jim");
        Value value = new SimpleStringValue(factory, "hello");
        Variable nameVar = new SimpleVariable(factory,
                                              name,
                                              value);
View Full Code Here

        // correct namespace (the namespace for no prefix is "no namespace"
        // according to http://www.w3.org/TR/xpath20/#id-variables - this
        // is modelled using the "default namespace" for variables)
        NamespacePrefixTracker namespacePrefixTracker =
                context.getNamespacePrefixTracker();
        ExpandedName name = namespacePrefixTracker.resolveQName(
                new ImmutableQName(variable), "");

        // Create a new TemplateExpressionValue
        TemplateExpressionValue initialValue = new TemplateExpressionValue(
                parameter, value, pipelineContext);
View Full Code Here

        // combination works correctly.
        state.setProcessBody(true);

        // Get the current name of the attribute that will be used to replace
        // the diselect:selid attribute.
        ExpandedName selidName = state.getSelidName();

        // Check to see whether the element supports a selidname attribute and
        // if so whether it is an element specific attribute, of the global
        // diselect one.
        String selidNameAttributeURI =
                diSelectElement.getSelidNameAttributeURI();
        if (selidNameAttributeURI != null) {

            // Check to see whether there is a selidname attribute, use the
            // index as we may need to remove the attribute.
            index = attributes.getIndex(selidNameAttributeURI, "selidname");
            if (index != -1) {
                String value = attributes.getValue(index);

                // Only update the attributes if the event is being
                // forwarded, otherwise it is a waste of time.
                if (forwardEvent) {
                    // Remove the attribute.
                    if (output == null) {
                        output = new AttributesImpl(attributes);

                        // Use the output attributes as the input to ensure that
                        // indeces match.
                        attributes = output;
                    }
                    output.removeAttribute(index);
                }

                // Resolve the value to an ExpandedName, update the value for
                // the current element and store it away just in case it is
                // needed for descendant elements.
                QName qname = new ImmutableQName(value);
                selidName = pipelineContext.getNamespacePrefixTracker()
                        .resolveQName(qname, null);
                state.setSelidName(selidName);
            }
        }

        // Only elements outside the diselect namespace support the
        // diselect:selid attribute.
        if (diSelectElement.canHaveSelidAttribute()) {
            // Now check for sel:selid attribute.
            index = attributes.getIndex(Constants.DISELECT_NAMESPACE, "selid");
            if (index != -1) {

                String idURI = selidName.getNamespaceURI();
                String idLocalName = selidName.getLocalName();
                String idQName;

                // Construct the selid attribute's qname, this is dependent on
                // the namespace of the selidName and the namespace prefix
                // mappings in scope.
View Full Code Here

                   scopeB.getEnclosingScope());
    }

    public void testDeclareVariable() throws Exception {

        ExpandedName nameX = new ImmutableExpandedName("", "x");
        ExpandedName nameY = new ImmutableExpandedName("", "y");
        ExpandedName nameX2 = new ImmutableExpandedName("http://myNamespace",
                                                        "x");
        Value x = factory.createStringValue("x");
        Value y = factory.createStringValue("y");
        Value x2 = factory.createStringValue("x2");
View Full Code Here

        }
    }

    public void testResolveVariable() throws Exception {

        ExpandedName nameX = new ImmutableExpandedName("", "x");
        ExpandedName nameY = new ImmutableExpandedName("", "y");
        ExpandedName nameX2 = new ImmutableExpandedName("http://myNamespace",
                                                        "x");
        ExpandedName duff = new ImmutableExpandedName("http://myNamespace",
                                                      "duff");
        Value x = factory.createStringValue("x");
        Value y = factory.createStringValue("y");
        Value x2 = factory.createStringValue("x2");
View Full Code Here

                    "An attempt has been made to declare a variable " +
                    "with a value that doesn't implement " +
                    Value.class.getName() +
                    " (" + value.getClass().getName() + ")");
        } else {
            ExpandedName name = expandName(variable);

            scope.declareVariable(name, (Value)value);
        }
    }
View Full Code Here

     *                                  NamespacePrefixTracker is not available
     *                                  or if the variable name is null or
     *                                  empty
     */
    private ExpandedName expandName(String name) {
        ExpandedName expandedName = null;

        if (name == null) {
            throw new IllegalArgumentException(
                    "Cannot expand a null variable name");
        } else if (name.trim().length() == 0) {
View Full Code Here

        final ExpressionScope expressionScope =
            getPipelineContext().getExpressionContext().getCurrentScope();
        for (Iterator iter = pendingVariableDeclarations.entrySet().iterator();
                iter.hasNext(); ) {
            final Map.Entry entry = (Map.Entry) iter.next();
            final ExpandedName name = (ExpandedName) entry.getKey();
            final Value initialValue = (Value) entry.getValue();
            expressionScope.declareVariable(name, initialValue);
        }
    }
View Full Code Here

            // Resolve the variable name into an ExpandedName, if the variable
            // name does not have a prefix then it belongs in no namespace,
            // rather than the default namespace.
            String variableName = attributes.getValue("variable");
            QName variableQName = new ImmutableQName(variableName);
            final ExpandedName variableExpandedName =
                    context.getNamespacePrefixTracker()
                    .resolveQName(variableQName, null);

            // If the sequence only has a single value in then it is not
            // necessary to store the body away to be evaluated multiple times.
View Full Code Here

TOP

Related Classes of com.volantis.xml.namespace.ExpandedName

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.