Examples of SimpleNamespaceContext


Examples of org.springframework.xml.namespace.SimpleNamespaceContext

    }

    private synchronized XPath createXPath() {
        XPath xpath = xpathFactory.newXPath();
        if (namespaces != null) {
            SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
            namespaceContext.setBindings(namespaces);
            xpath.setNamespaceContext(namespaceContext);
        }
        return xpath;
    }
View Full Code Here

Examples of org.springframework.xml.namespace.SimpleNamespaceContext

     * @param method the method to create the namespace context for
     * @return the namespace context
     */
    public static NamespaceContext getNamespaceContext(Method method) {
        Assert.notNull(method, "'method' must not be null");
        SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
        Class<?> endpointClass = method.getDeclaringClass();
        Package endpointPackage = endpointClass.getPackage();
        if (endpointPackage != null) {
            addNamespaceAnnotations(endpointPackage, namespaceContext);
        }
View Full Code Here

Examples of org.springframework.xml.namespace.SimpleNamespaceContext

     * @throws XPathParseException when the given expression cannot be parsed
     */
    public static XPathExpression createXPathExpression(String expression, Map<String, String> namespaces) {
        try {
            XPath xpath = createXPath();
            SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
            namespaceContext.setBindings(namespaces);
            xpath.setNamespaceContext(namespaceContext);
            javax.xml.xpath.XPathExpression xpathExpression = xpath.compile(expression);
            return new Jaxp13XPathExpression(xpathExpression);
        }
        catch (XPathExpressionException ex) {
View Full Code Here

Examples of org.springframework.xml.namespace.SimpleNamespaceContext

    }

    private Object evaluate(String expression, Source context, QName returnType) throws XPathException {
        XPath xpath = createXPath();
        if (getNamespaces() != null && !getNamespaces().isEmpty()) {
            SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
            namespaceContext.setBindings(getNamespaces());
            xpath.setNamespaceContext(namespaceContext);
        }
        try {
            EvaluationCallback callback = new EvaluationCallback(xpath, expression, returnType);
            TraxUtils.doWithSource(context, callback);
View Full Code Here

Examples of org.xmlmatchers.namespace.SimpleNamespaceContext

    StringReader inputReader = new StringReader( inputXml );
    XmlFilterReader filterReader = new NoopXmlFilterReader( inputReader, null );
    String outputHtml = new String( IOUtils.toCharArray( filterReader ) );

    //System.out.println( outputHtml );
    SimpleNamespaceContext ns = new SimpleNamespaceContext();
    ns.bind( "ns", "http://hortonworks.com/xml/ns" );
    assertThat( the( outputHtml ), hasXPath( "/ns:root", ns ) );
  }
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.