Examples of PrefixResolver


Examples of com.sun.org.apache.xml.internal.utils.PrefixResolver

   
   
   
    // Setting namespace context to XPath
    // Assuming that the namespace prefix in the mapping xpath is the same as the one used in the document
    final PrefixResolver resolver = new PrefixResolverDefault(doc.getDocumentElement());
   
    NamespaceContext ctx = new NamespaceContext() {
   
           public String getNamespaceURI(String prefix) {
                  return resolver.getNamespaceForPrefix(prefix);
           }
           // Dummy implementation - not used!
           public Iterator getPrefixes(String val) {
             return null;
           }
View Full Code Here

Examples of org.apache.excalibur.xml.xpath.PrefixResolver

            Number number = processor.evaluateAsNumber(document1, expr);
            assertEquals(2, number.intValue());

            // 5. Test with a custom prefix resolver using a different document in a different namespace,
            // to be sure the custom prefix resolver is used
            number = processor.evaluateAsNumber(document2, expr, new PrefixResolver() {
                public String prefixToNamespace(String prefix)
                {
                    if (prefix.equals("test"))
                        return "http://localhost/test2";
                    return null;
View Full Code Here

Examples of org.apache.xalan.xpath.xml.PrefixResolver

   * the error condition is severe enough to halt processing.
   */
  public XObject execute(XPathSupport execContext, Node contextNode,
                        PrefixResolver namespaceContext)
  {   
    PrefixResolver savedPrefixResolver = execContext.getNamespaceContext();
    execContext.setNamespaceContext(namespaceContext);
    execContext.setCurrentNode(contextNode);
    XObject xobj = null;
    try
    {
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

                  continue;

               Node n = d.getDocumentElement();

               XPathContext xpc = new XPathContext();
               PrefixResolver pfx;
               if ( pr == null ) {
                  pfx = new PrefixResolverDefault(d.getDocumentElement());
                  xp = new XPath(query, null, pfx, XPath.SELECT, errors);
               }
               else {
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

    // Since we don't have a XML Parser involved here, install some default
    // support for things like namespaces, etc.
    XPathContext xpathSupport = new XPathContext();

    PrefixResolver prefixResolver = null;
    // Create an object to resolve namespace prefixes.
    if (namespace != null)
    {
      if (namespace.getNodeType() == Node.DOCUMENT_NODE)
      {
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

    public Object createXPath(String xpath) throws XPathException {
        return xpath;
    }
    public XResult evaluateXPath(Node node, Object xpath, NamespaceContext nsContext) throws XPathException {
        try {
            PrefixResolver pr = nsContext!=null ? new NSResolver(nsContext) : null;
            XObject res = XPathAPI.eval(node,(String)xpath,pr);
            return convertResult(res);
        } catch(Exception e) {
            throw new XPathException(e,"Error while evaluating XPath {0}",xpath.toString()); // $NLS-AbstractXercesDriver.ErrorwhileevaluatingXPath0-1$
        }
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

    public XResult evaluateXPath(NodeList nodeList, Object xpath, NamespaceContext nsContext) throws XPathException {
        try {
            if(nodeList.getLength()>0) {
                XResult result = null;
                NodeListImpl nodes = null;
                PrefixResolver pr = nsContext!=null ? new NSResolver(nsContext) : null;
                for( int i=0; i<nodeList.getLength(); i++ ) {
                    XObject res = XPathAPI.eval(nodeList.item(i),(String)xpath,pr);
                    switch(res.getType()) {
                        case XObject.CLASS_BOOLEAN: {
                            if(nodes!=null) {
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

    public Object createXPath(String xpath) throws XPathException {
        return xpath;
    }
    public XResult evaluateXPath(Node node, Object xpath, NamespaceContext nsContext) throws XPathException {
        try {
            PrefixResolver pr = nsContext!=null ? new NSResolver(nsContext) : null;
            XObject res = XPathAPI.eval(node,(String)xpath,pr);
            return convertResult(res);
        } catch(Exception e) {
            throw new XPathException(e,"Error while evaluating XPath {0}",xpath.toString()); // $NLS-AbstractXercesDriver.ErrorwhileevaluatingXPath0-1$
        }
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

    public XResult evaluateXPath(NodeList nodeList, Object xpath, NamespaceContext nsContext) throws XPathException {
        try {
            if(nodeList.getLength()>0) {
                XResult result = null;
                NodeListImpl nodes = null;
                PrefixResolver pr = nsContext!=null ? new NSResolver(nsContext) : null;
                for( int i=0; i<nodeList.getLength(); i++ ) {
                    XObject res = XPathAPI.eval(nodeList.item(i),(String)xpath,pr);
                    switch(res.getType()) {
                        case XObject.CLASS_BOOLEAN: {
                            if(nodes!=null) {
View Full Code Here

Examples of org.apache.xml.utils.PrefixResolver

                          boolean isTopLevel,
                          int stackFrame,
                          Expression expr )
    throws org.apache.xml.utils.WrappedRuntimeException
  {
    PrefixResolver savedResolver = xctxt.getNamespaceContext();
    XNodeSet result = null;

    try
    {
      xctxt.pushCurrentNode(context);
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.