Tabnine Logo
org.apache.xpath.domapi
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.xpath.domapi

Best Java code snippets using org.apache.xpath.domapi (Showing top 20 results out of 315)

origin: xalan/xalan

/**
 * @exception DOMException
 *   NAMESPACE_ERR: Always throws this exceptionn
 * 
 * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String)
 */
public String getNamespaceForPrefix(String prefix) {
  return getNamespaceForPrefix(prefix,null);
}
origin: xalan/xalan

/**
 * Adapts any DOM node to resolve namespaces so that an XPath expression 
 * can be easily evaluated relative to the context of the node where it 
 * appeared within the document. This adapter works like the DOM Level 3 
 * method <code>lookupNamespaceURI</code> on nodes in resolving the 
 * namespaceURI from a given prefix using the current information available 
 * in the node's hierarchy at the time lookupNamespaceURI is called, also 
 * correctly resolving the implicit xml prefix.
 *
 * @param nodeResolver The node to be used as a context for namespace 
 *   resolution.
 * @return <code>XPathNSResolver</code> which resolves namespaces with 
 *   respect to the definitions in scope for a specified node.
 *  
 * @see org.w3c.dom.xpath.XPathEvaluator#createNSResolver(Node)
 */
public XPathNSResolver createNSResolver(Node nodeResolver) {

  return new XPathNSResolverImpl((nodeResolver.getNodeType() == Node.DOCUMENT_NODE)
      ? ((Document) nodeResolver).getDocumentElement() : nodeResolver);
}
origin: xalan/xalan

/**
 * @see org.w3c.dom.events.EventListener#handleEvent(Event)
 */
public void handleEvent(Event event) {
  
  if (event.getType().equals("DOMSubtreeModified")) {
    // invalidate the iterator
    m_isInvalidIteratorState = true;
    
    // deregister as a listener to reduce computational load
    removeEventListener();
  }
}
 
origin: xalan/xalan

if ((m_resultType != UNORDERED_NODE_ITERATOR_TYPE) &&
  (m_resultType != ORDERED_NODE_ITERATOR_TYPE)) {
 String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_ITERATOR_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});                        
 throw new XPathException(XPathException.TYPE_ERR, fmsg);  
if (getInvalidIteratorState()) {
 String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_DOC_MUTATED, null);                        
 throw new DOMException(DOMException.INVALID_STATE_ERR,fmsg);  // Document mutated since result was returned. Iterator is invalid.
  removeEventListener(); // JIRA 1673
if (isNamespaceNode(node)) {
  return new XPathNamespaceImpl(node);
} else {
  return node;
origin: xalan/xalan

if (!isValidType(type)) {
  String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)});       
  throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0}           
  this.m_resultType = getTypeFromXObject(result);
} else {
  this.m_resultType = type;
    addEventListener();
  } catch (TransformerException te) {
    String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)});       
     throw new XPathException(XPathException.TYPE_ERR, fmsg);  // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."},
  } catch (TransformerException te) {
    String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INCOMPATIBLE_TYPES, new Object[] {m_xpath.getPatternString(), getTypeString(getTypeFromXObject(m_resultObj)),getTypeString(m_resultType)});       
    throw new XPathException(XPathException.TYPE_ERR, fmsg); // "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be coerced into the specified XPathResultType of {2}."},
origin: xalan/xalan

  String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NON_SNAPSHOT_TYPE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});                        
  throw new XPathException(XPathException.TYPE_ERR, fmsg); 
if (isNamespaceNode(node)) {
  return new XPathNamespaceImpl(node);
} else {
  return node;
origin: robovm/robovm

ErrorListener ehandler = this.getErrorListener();
TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
if (null != ehandler)
origin: xalan/xalan

  /**
   * @see org.w3c.dom.xpath.XPathResult#getBooleanValue()
   */
  public boolean getBooleanValue() throws XPathException {
    if (getResultType() != BOOLEAN_TYPE) {
      String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_BOOLEAN, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});		
      throw new XPathException(XPathException.TYPE_ERR,fmsg);
//        "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a boolean."            
    } else {
      try {
        return m_resultObj.bool();
      } catch (TransformerException e) {
        // Type check above should prevent this exception from occurring.
        throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
      }
    }
  }
 
origin: xalan/xalan

   ((null == resolver) ? new DummyPrefixResolver() : ((PrefixResolver)resolver)), 
   XPath.SELECT);
return new XPathExpressionImpl(xpath, m_doc);
origin: xalan/xalan

if (!XPathResultImpl.isValidType(type)) {
  String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_INVALID_XPATH_TYPE, new Object[] {new Integer(type)});       
  throw new XPathException(XPathException.TYPE_ERR,fmsg); // Invalid XPath type argument: {0}               
return new XPathResultImpl(type,xobj,contextNode, m_xpath);
origin: xalan/xalan

throws XPathException, DOMException {
XPathExpression xpathExpression = createExpression(expression, resolver);
origin: xalan/xalan

  /**
   * The number of nodes in the result snapshot. Valid values for 
   * snapshotItem indices are <code>0</code> to 
   * <code>snapshotLength-1</code> inclusive.
   * @exception XPathException
   *   TYPE_ERR: raised if <code>resultType</code> is not 
   *   <code>UNORDERED_NODE_SNAPSHOT_TYPE</code> or 
   *   <code>ORDERED_NODE_SNAPSHOT_TYPE</code>.
   * 
   * @see org.w3c.dom.xpath.XPathResult#getSnapshotLength()
   */
  public int getSnapshotLength() throws XPathException {
  
    if ((m_resultType != UNORDERED_NODE_SNAPSHOT_TYPE) &&
      (m_resultType != ORDERED_NODE_SNAPSHOT_TYPE)) {
        String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_GET_SNAPSHOT_LENGTH, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});                        
        throw new XPathException(XPathException.TYPE_ERR,fmsg); 
//                "The method getSnapshotLength cannot be called on the XPathResult of XPath expression {0} because its XPathResultType is {1}.
    }
      
    return m_list.getLength();
  }
 
origin: xalan/xalan

  /**
   * The value of this string result.
   * @exception XPathException
   *   TYPE_ERR: raised if <code>resultType</code> is not 
   *   <code>STRING_TYPE</code>.
   * 
   * @see org.w3c.dom.xpath.XPathResult#getStringValue()
   */
  public String getStringValue() throws XPathException {
    if (getResultType() != STRING_TYPE) {
      String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_STRING, new Object[] {m_xpath.getPatternString(), m_resultObj.getTypeString()});		
      throw new XPathException(XPathException.TYPE_ERR,fmsg);
//        "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a string."
    } else {
      try {
        return m_resultObj.str();
      } catch (Exception e) {
        // Type check above should prevent this exception from occurring.
        throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
      }
    }
  }
 
origin: xalan/xalan

    String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_TO_SINGLENODE, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});                        
    throw new XPathException(XPathException.TYPE_ERR,fmsg);
if (isNamespaceNode(node)) {
  return new XPathNamespaceImpl(node);
} else {
  return node;
origin: xalan/xalan

ErrorListener ehandler = this.getErrorListener();
TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator);
if (null != ehandler)
origin: xalan/xalan

  /**
   *  The value of this number result.
   * @exception XPathException
   *   TYPE_ERR: raised if <code>resultType</code> is not 
   *   <code>NUMBER_TYPE</code>.
   * @see org.w3c.dom.xpath.XPathResult#getNumberValue()
   */
  public double getNumberValue() throws XPathException {
    if (getResultType() != NUMBER_TYPE) {
      String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER, new Object[] {m_xpath.getPatternString(), getTypeString(m_resultType)});		
      throw new XPathException(XPathException.TYPE_ERR,fmsg);
//        "The XPathResult of XPath expression {0} has an XPathResultType of {1} which cannot be converted to a number"
    } else {
      try {
        return m_resultObj.num();
      } catch (Exception e) {
        // Type check above should prevent this exception from occurring.
        throw new XPathException(XPathException.TYPE_ERR,e.getMessage());
      }
    }        
  }
 
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

/**
 * @exception DOMException
 *   NAMESPACE_ERR: Always throws this exceptionn
 * 
 * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String)
 */
public String getNamespaceForPrefix(String prefix) {
  return getNamespaceForPrefix(prefix,null);
}
origin: org.apache.xalan/com.springsource.org.apache.xalan

/**
 * @see org.w3c.dom.events.EventListener#handleEvent(Event)
 */
public void handleEvent(Event event) {
  
  if (event.getType().equals("DOMSubtreeModified")) {
    // invalidate the iterator
    m_isInvalidIteratorState = true;
    
    // deregister as a listener to reduce computational load
    removeEventListener();
  }
}
 
origin: org.apache.karaf.bundles/org.apache.karaf.bundles.xalan-2.7.1

/**
 * @exception DOMException
 *   NAMESPACE_ERR: Always throws this exceptionn
 * 
 * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String)
 */
public String getNamespaceForPrefix(String prefix) {
  return getNamespaceForPrefix(prefix,null);
}
origin: org.apache.xalan/com.springsource.org.apache.xalan

/**
 * @exception DOMException
 *   NAMESPACE_ERR: Always throws this exceptionn
 * 
 * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String)
 */
public String getNamespaceForPrefix(String prefix) {
  return getNamespaceForPrefix(prefix,null);
}
org.apache.xpath.domapi

Most used classes

  • XPathStylesheetDOM3Exception
    A new exception to add support for DOM Level 3 XPath API. This class is needed to throw a org.w3c.do
  • XPathEvaluatorImpl$DummyPrefixResolver
    This prefix resolver is created whenever null is passed to the evaluate method. Its purpose is to sa
  • XPathEvaluatorImpl
    The class provides an implementation of XPathEvaluator according to the DOM L3 XPath Specification,
  • XPathExpressionImpl
    The class provides an implementation of XPathExpression according to the DOM L3 XPath Specification,
  • XPathNSResolverImpl
    The class provides an implementation XPathNSResolver according to the DOM L3 XPath Specification, Wo
  • XPathResultImpl
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now