org.apache.xpath.res.XPATHMessages类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中org.apache.xpath.res.XPATHMessages类的一些代码示例,展示了XPATHMessages类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPATHMessages类的具体详情如下:
包路径:org.apache.xpath.res.XPATHMessages
类名称:XPATHMessages

XPATHMessages介绍

[英]A utility class for issuing XPath error messages.
[中]用于发出XPath错误消息的实用程序类。

代码示例

代码示例来源:origin: xalan/xalan

/**
 * @exception DOMException
 *   NAMESPACE_ERR: Always throws this exceptionn
 *
 * @see org.apache.xml.utils.PrefixResolver#getNamespaceForPrefix(String, Node)
 */
public String getNamespaceForPrefix(String prefix, Node context) {
  String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_RESOLVER, null);       
  throw new DOMException(DOMException.NAMESPACE_ERR, fmsg);   // Unable to resolve prefix with null prefix resolver.         
}

代码示例来源:origin: robovm/robovm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源:origin: xalan/xalan

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
 if (XPATHBundle == null)
  XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
 if (XPATHBundle != null)
 {
  return createXPATHMsg(XPATHBundle, msgKey, args);
 }
 else
  return "Could not load any resource bundles.";
}

代码示例来源: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: robovm/robovm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源:origin: xalan/xalan

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
 if (XPATHBundle == null)
  XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
 
 if (XPATHBundle != null)
 {
  return createXPATHMsg(XPATHBundle, msgKey, args);
 }
 else
  return "Could not load any resource bundles.";
}

代码示例来源: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: ibinti/bugvm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
 if (XPATHBundle == null)
  XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
 
 if (XPATHBundle != null)
 {
  return createXPATHMsg(XPATHBundle, msgKey, args);
 }
 else
  return "Could not load any resource bundles.";
}

代码示例来源:origin: xalan/xalan

String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_DOCUMENT, null);       
  throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, fmsg);
  (nodeType != Document.PROCESSING_INSTRUCTION_NODE) &&
  (nodeType != XPathNamespace.XPATH_NAMESPACE_NODE)) {
    String fmsg = XPATHMessages.createXPATHMessage(XPATHErrorResources.ER_WRONG_NODETYPE, null);       
    throw new DOMException(DOMException.NOT_SUPPORTED_ERR, fmsg);
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}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
 if (XPATHBundle == null)
  XPATHBundle = loadResourceBundle(XPATH_ERROR_RESOURCES);
 if (XPATHBundle != null)
 {
  return createXPATHMsg(XPATHBundle, msgKey, args);
 }
 else
  return "Could not load any resource bundles.";
}

代码示例来源: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: MobiVM/robovm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源: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: com.bugvm/bugvm-rt

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey    The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted message string.
 */
public static final String createXPATHMessage(String msgKey, Object args[])  //throws Exception 
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源: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);

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

代码示例来源:origin: robovm/robovm

XPATHMessages.createXPATHMessage(
 XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED,
 new Object[] {toString()}));

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates a message from the specified key and replacement
 * arguments, localized to the given locale.
 *
 * @param msgKey The key for the message text.
 * @param args      The arguments to be used as replacement text
 *                  in the message created.
 *
 * @return The formatted warning string.
 */
public static final String createXPATHWarning(String msgKey, Object args[])  //throws Exception
{
  // BEGIN android-changed
  //     don't localize exception messages
  return createXPATHMsg(XPATHBundle, msgKey, args);
  // END android-changed
}

相关文章

微信公众号

最新文章

更多