Package com.volantis.xml.namespace

Examples of com.volantis.xml.namespace.NamespacePrefixTracker


        // retrieve the PipelineContext
        XMLPipelineContext context =
                dynamicProcess.getPipeline().getPipelineContext();
        // get hold of the NamespacePrefixTracker so that we can
        // access the registered prefixes
        NamespacePrefixTracker prefixTracker =
                context.getNamespacePrefixTracker();
        // obtain the prefix for the specified namespace URI
        String prefix = prefixTracker.getNamespacePrefix(
                expandedName.getNamespaceURI());
        // local name
        String qName = expandedName.getLocalName();
        if (prefix != null) {
            StringBuffer sb = new StringBuffer(
View Full Code Here


     * @return the expression context
     */
    private ExpressionContext createExpressionContext() {
        EnvironmentInteractionTracker eit =
                new SimpleEnvironmentInteractionTracker();
        NamespacePrefixTracker npt = new DefaultNamespacePrefixTracker();
        ExpressionContext context = ExpressionFactory.getDefaultInstance().
                createExpressionContext(eit, npt);
        return context;
    }
View Full Code Here

        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
       
        // ensure that the pipeline contexts NamespacePrefixTracker has
        // been updated       
        NamespacePrefixTracker tracker = context.getNamespacePrefixTracker();

        assertEquals("NamespacePrefixTracker was not updated with the " +
                     "startPrefixMapping event",
                     namespace,
                     tracker.getNamespaceURI(prefix));      
               
        // ensure the event was forwarded to the next process
        next.assertStartPrefixMappingInvoked(prefix, namespace);
    }
View Full Code Here

        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
       
        // Update pipeline contexts NamespacePrefixTracker with a prefix
        // and namespace pair
        NamespacePrefixTracker tracker = context.getNamespacePrefixTracker();
        tracker.startPrefixMapping(prefix, namespace);

        assertEquals("NamespacePrefixTracker was not updated with the " +
                     "startPrefixMapping event",
                     namespace,
                     tracker.getNamespaceURI(prefix));      
                     
        // invoke the method that is being tested
        process.endPrefixMapping(prefix);
       
        // ensure that the NamespacePrefixTracker has been updated
        assertNull("NamespacePrefixTracker was not updated with the " +
                   "endPrefixMapping event",                   
                     tracker.getNamespaceURI(prefix));
       
        // ensure the event was forwarded to the next process
        next.assertEndPrefixMappingInvoked(prefix);
    }
View Full Code Here

                                                       "testLocalName");
        Attributes atts = new AttributesImpl();       
       
        XMLPipeline pipeline = dynamicProcess.getPipeline();       
       
        NamespacePrefixTracker tracker =
                pipeline.getPipelineContext().getNamespacePrefixTracker();
       
        // register the prefix with the tracker
        tracker.startPrefixMapping("p", "testNamespace");
           
        // invoke startElement on the rule
        Object returned = rule.startElement(dynamicProcess, eName, atts);    
       
        // ensure the process was added to the pipeline
View Full Code Here

    public JXPathFunctionsTestCase(String name) {
        super(name);
    }

    public void testGetUsedNamespaces() throws Exception {
        NamespacePrefixTracker namespacePrefixTracker =
            new DefaultNamespacePrefixTracker();
        JXPathFunctions functions =
            new JXPathFunctions(namespacePrefixTracker);
        ImmutableExpandedName nameA =
            new ImmutableExpandedName("http://spaceA",
View Full Code Here

                     expectedURLs,
                     namespaceURLs);
    }

    public void testGetFunction() throws Exception {
        NamespacePrefixTracker namespacePrefixTracker =
            new DefaultNamespacePrefixTracker();
        JXPathFunctions functions =
            new JXPathFunctions(namespacePrefixTracker);
        ImmutableExpandedName nameA =
            new ImmutableExpandedName("http://spaceA",
                                      "a");
        ImmutableExpandedName nameB = new ImmutableExpandedName("", "b");
        ImmutableExpandedName nameC =
            new ImmutableExpandedName("http://spaceC",
                                      "c");
        Function a = new TestFunction();
        Function b = new TestFunction();

        functions.addFunction(nameA, a);
        functions.addFunction(nameB, b);

        // Add the non-default prefixes
        namespacePrefixTracker.startPrefixMapping("spaceA",
                                                  nameA.getNamespaceURI());
        namespacePrefixTracker.startPrefixMapping("spaceC",
                                                  nameC.getNamespaceURI());
       
        assertSame("function A",
                   a,
                   functions.getFunction("spaceA",
View Full Code Here

     */
    public void testUnprefixedFunction() throws Exception {
        // create a function
        Function function = new TestFunction();
        // create a JXPathFunctions instance
        NamespacePrefixTracker namespacePrefixTracker =
            new DefaultNamespacePrefixTracker();
        JXPathFunctions functions =
            new JXPathFunctions(namespacePrefixTracker);

        ImmutableExpandedName eName = new ImmutableExpandedName("", "foo");
View Full Code Here

                   function,
                   functions.getFunction(null, "foo", null));
    }

    public void testAddFunction() throws Exception {
        NamespacePrefixTracker namespacePrefixTracker =
            new DefaultNamespacePrefixTracker();
        JXPathFunctions functions =
            new JXPathFunctions(namespacePrefixTracker);
        ImmutableExpandedName nameA =
            new ImmutableExpandedName("http://spaceA",
View Full Code Here

            Function function = (Function) entry.getValue();
            context.registerFunction(name, function);
        }

        // Register the default prefixes.
        NamespacePrefixTracker tracker = context.getNamespacePrefixTracker();
        for (Iterator i = mappings.entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            String prefix = (String) entry.getKey();
            String namespaceURI = (String) entry.getValue();
            tracker.startPrefixMapping(prefix, namespaceURI);
        }
    }
View Full Code Here

TOP

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

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.