当前位置: 首页>>代码示例>>Java>>正文


Java XSLMessages类代码示例

本文整理汇总了Java中org.apache.xalan.res.XSLMessages的典型用法代码示例。如果您正苦于以下问题:Java XSLMessages类的具体用法?Java XSLMessages怎么用?Java XSLMessages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XSLMessages类属于org.apache.xalan.res包,在下文中一共展示了XSLMessages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Execute the function.  The function must return
 * a valid object.
 * @param xctxt The current execution context.
 * @return A valid XObject.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
 
  SubContextList subContextList = xctxt.getCurrentNodeList();
  int currentNode = DTM.NULL;

  if (null != subContextList) {
      if (subContextList instanceof PredicatedNodeTest) {
          LocPathIterator iter = ((PredicatedNodeTest)subContextList)
                                                        .getLocPathIterator();
          currentNode = iter.getCurrentContextNode();
       } else if(subContextList instanceof StepPattern) {
         throw new RuntimeException(XSLMessages.createMessage(
            XSLTErrorResources.ER_PROCESSOR_ERROR,null));
       }
  } else {
      // not predicate => ContextNode == CurrentNode
      currentNode = xctxt.getContextNode();
  }
  return new XNodeSet(currentNode, xctxt.getDTMManager());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:30,代码来源:FuncCurrent.java

示例2: warn

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Warn the user of an problem.
 *
 * @param xctxt The XPath runtime context.
 * @param sourceNode Not used.
 * @param msg An error msgkey that corresponds to one of the constants found 
 *            in {@link org.apache.xpath.res.XPATHErrorResources}, which is 
 *            a key for a format string.
 * @param args An array of arguments represented in the format string, which 
 *             may be null.
 *
 * @throws TransformerException if the current ErrorListoner determines to 
 *                              throw an exception.
 */
public void warn(
        XPathContext xctxt, int sourceNode, String msg, Object[] args)
          throws javax.xml.transform.TransformerException
{

  String fmsg = XSLMessages.createXPATHWarning(msg, args);
  ErrorListener ehandler = xctxt.getErrorListener();

  if (null != ehandler)
  {

    // TO DO: Need to get stylesheet Locator from here.
    ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator()));
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:30,代码来源:XPath.java

示例3: error

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Tell the user of an error, and probably throw an
 * exception.
 *
 * @param msg An error msgkey that corresponds to one of the constants found 
 *            in {@link org.apache.xpath.res.XPATHErrorResources}, which is 
 *            a key for a format string.
 * @param args An array of arguments represented in the format string, which 
 *             may be null.
 *
 * @throws TransformerException if the current ErrorListoner determines to 
 *                              throw an exception.
 */
public void error(String msg, Object[] args) throws TransformerException
{

  java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
  

  if (null != m_errorHandler)
  {
    m_errorHandler.fatalError(new TransformerException(fmsg, m_locator));
  }
  else
  {

    // System.out.println(te.getMessage()
    //                    +"; file "+te.getSystemId()
    //                    +"; line "+te.getLineNumber()
    //                    +"; column "+te.getColumnNumber());
    throw new TransformerException(fmsg, (SAXSourceLocator)m_locator);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:Compiler.java

示例4: setFeature

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s
 * or <code>Template</code>s created by this factory.</p>
 * 
 * <p>
 * Feature names are fully qualified {@link java.net.URI}s.
 * Implementations may define their own features.
 * An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
 * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
 * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
 * </p>
 * 
 * <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
 * 
 * @param name Feature name.
 * @param value Is feature state <code>true</code> or <code>false</code>.
 *  
 * @throws TransformerConfigurationException if this <code>TransformerFactory</code>
 *   or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
 * @throws NullPointerException If the <code>name</code> parameter is null.
 */
public void setFeature(String name, boolean value)
 throws TransformerConfigurationException {

	// feature name cannot be null
	if (name == null) {
	    throw new NullPointerException(
                XSLMessages.createMessage(
                    XSLTErrorResources.ER_SET_FEATURE_NULL_NAME, null));    
	}
		
	// secure processing?
	if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
	    m_isSecureProcessing = value;			
	}
	// This implementation does not support the setting of a feature other than
	// the secure processing feature.
	else
  {
    throw new TransformerConfigurationException(
        XSLMessages.createMessage(
          XSLTErrorResources.ER_UNSUPPORTED_FEATURE, 
          new Object[] {name}));
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:46,代码来源:TransformerFactoryImpl.java

示例5: characters

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Receive notification of character data inside an element.
 *
 * @param ch The characters.
 * @param start The start position in the character array.
 * @param length The number of characters to use from the
 *               character array.
 * @see org.xml.sax.ContentHandler#characters
 *
 * @throws org.xml.sax.SAXException Any SAX exception, possibly
 *            wrapping another exception.
 */
public void characters(char ch[], int start, int length)
        throws org.xml.sax.SAXException
{

  if (!m_shouldProcess)
    return;

  XSLTElementProcessor elemProcessor = getCurrentProcessor();
  XSLTElementDef def = elemProcessor.getElemDef();

  if (def.getType() != XSLTElementDef.T_PCDATA)
    elemProcessor = def.getProcessorFor(null, "text()");

  if (null == elemProcessor)
  {

    // If it's whitespace, just ignore it, otherwise flag an error.
    if (!XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
      error(
        XSLMessages.createMessage(XSLTErrorResources.ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, null),null);//"Non-whitespace text is not allowed in this position in the stylesheet!",
        
  }
  else
    elemProcessor.characters(this, ch, start, length);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:38,代码来源:StylesheetHandler.java

示例6: warn

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Warn the user of an problem.
 *
 * @param msg An key into the {@link org.apache.xalan.res.XSLTErrorResources}
 * table, that is one of the WG_ prefixed definitions.
 * @param args An array of arguments for the given warning.
 *
 * @throws org.xml.sax.SAXException that wraps a
 * {@link javax.xml.transform.TransformerException} if the current
 * {@link javax.xml.transform.ErrorListener#warning}
 * method chooses to flag this condition as an error.
 * @xsl.usage internal
 */
public void warn(String msg, Object args[]) throws org.xml.sax.SAXException
{

  String formattedMsg = XSLMessages.createWarning(msg, args);
  SAXSourceLocator locator = getLocator();
  ErrorListener handler = m_stylesheetProcessor.getErrorListener();

  try
  {
    if (null != handler)
      handler.warning(new TransformerException(formattedMsg, locator));
  }
  catch (TransformerException te)
  {
    throw new org.xml.sax.SAXException(te);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:31,代码来源:StylesheetHandler.java

示例7: processPREFIX_LIST

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Process an attribute string of type T_PREFIXLIST into
 * a vector of prefixes that may be resolved to URLs.
 *
 * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
 * @param uri The Namespace URI, or an empty string.
 * @param name The local name (without prefix), or empty string if not namespace processing.
 * @param rawName The qualified name (with prefix).
 * @param value A list of whitespace delimited prefixes.
 *
 * @return A vector of strings that may be resolved to URLs.
 *
 * @throws org.xml.sax.SAXException if one of the prefixes can not be resolved.
 */
StringVector processPREFIX_LIST(
        StylesheetHandler handler, String uri, String name, 
        String rawName, String value) throws org.xml.sax.SAXException
{
 
  StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
  int nStrings = tokenizer.countTokens();
  StringVector strings = new StringVector(nStrings);

  for (int i = 0; i < nStrings; i++)
  {
    String prefix = tokenizer.nextToken();
    String url = handler.getNamespaceForPrefix(prefix);
    if (prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX) || url != null)
      strings.addElement(prefix);
    else
      throw new org.xml.sax.SAXException(
           XSLMessages.createMessage(
                XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, 
                new Object[] {prefix}));
 
  }

  return strings;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:40,代码来源:XSLTAttributeDef.java

示例8: setupParse

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
   * Set up before a parse.
   *
   * <p>Before every parse, check whether the parent is
   * non-null, and re-register the filter for all of the 
   * events.</p>
   */
  private void setupParse ()
  {
    XMLReader p = getParent();
    if (p == null) {
      throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_PARENT_FOR_FILTER, null)); //"No parent for filter");
    }
    
    ContentHandler ch = m_transformer.getInputContentHandler();
//    if(ch instanceof SourceTreeHandler)
//      ((SourceTreeHandler)ch).setUseMultiThreading(true);
    p.setContentHandler(ch);
    p.setEntityResolver(this);
    p.setDTDHandler(this);
    p.setErrorHandler(this);
  }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:TrAXFilter.java

示例9: error

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Tell the user of an error, and probably throw an
 * exception.
 *
 * @param xctxt The XPath runtime context.
 * @param sourceNode Not used.
 * @param msg An error msgkey that corresponds to one of the constants found 
 *            in {@link org.apache.xpath.res.XPATHErrorResources}, which is 
 *            a key for a format string.
 * @param args An array of arguments represented in the format string, which 
 *             may be null.
 *
 * @throws TransformerException if the current ErrorListoner determines to 
 *                              throw an exception.
 */
public void error(
        XPathContext xctxt, int sourceNode, String msg, Object[] args)
          throws javax.xml.transform.TransformerException
{

  String fmsg = XSLMessages.createXPATHMessage(msg, args);
  ErrorListener ehandler = xctxt.getErrorListener();

  if (null != ehandler)
  {
    ehandler.fatalError(new TransformerException(fmsg,
                            (SAXSourceLocator)xctxt.getSAXLocator()));
  }
  else
  {
    SourceLocator slocator = xctxt.getSAXLocator();
    System.out.println(fmsg + "; file " + slocator.getSystemId()
                       + "; line " + slocator.getLineNumber() + "; column "
                       + slocator.getColumnNumber());
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:37,代码来源:XPath.java

示例10: getOutputProperty

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Get an output property that is in effect for the
 * transformation.  The property specified may be a property
 * that was set with setOutputProperty, or it may be a
 * property specified in the stylesheet.
 *
 * NEEDSDOC @param qnameString
 *
 * @return The string value of the output property, or null
 * if no property was found.
 *
 * @throws IllegalArgumentException If the property is not supported.
 *
 * @see javax.xml.transform.OutputKeys
 */
public String getOutputProperty(String qnameString)
        throws IllegalArgumentException
{

  String value = null;
  OutputProperties props = getOutputFormat();

  value = props.getProperty(qnameString);

  if (null == value)
  {
    if (!OutputProperties.isLegalPropertyKey(qnameString))
      throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{qnameString})); //"output property not recognized: "
                                         //+ qnameString);
  }

  return value;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:TransformerImpl.java

示例11: setContentHandler

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Set the content event handler.
 *
 * NEEDSDOC @param handler
 * @throws java.lang.NullPointerException If the handler
 *            is null.
 * @see org.xml.sax.XMLReader#setContentHandler
 */
public void setContentHandler(ContentHandler handler)
{

  if (handler == null)
  {
    throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_CONTENT_HANDLER, null)); //"Null content handler");
  }
  else
  {
    m_outputContentHandler = handler;

    if (null == m_serializationHandler)
    {
      ToXMLSAXHandler h = new ToXMLSAXHandler();
      h.setContentHandler(handler);
      h.setTransformer(this);
      
      m_serializationHandler = h;
    }
    else
      m_serializationHandler.setContentHandler(handler);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:32,代码来源:TransformerImpl.java

示例12: getOutputProperty

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Get an output property that is in effect for the
 * transformation.  The property specified may be a property
 * that was set with setOutputProperty, or it may be a
 * property specified in the stylesheet.
 *
 * @param name A non-null String that specifies an output
 * property name, which may be namespace qualified.
 *
 * @return The string value of the output property, or null
 * if no property was found.
 *
 * @throws IllegalArgumentException If the property is not supported.
 *
 * @see javax.xml.transform.OutputKeys
 */
public String getOutputProperty(String name) throws IllegalArgumentException
{

  String value = null;
  OutputProperties props = m_outputFormat;

  value = props.getProperty(name);

  if (null == value)
  {
    if (!OutputProperties.isLegalPropertyKey(name))
      throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: "
                                        // + name);
  }

  return value;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:TransformerIdentityImpl.java

示例13: error

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Tell the user of an error, and probably throw an
 * exception.
 *
 * @param msg Error message to issue
 * @param args Arguments to use in the message
 *
 * @throws javax.xml.transform.TransformerException
 */
protected void error(String msg, Object[] args)
        throws javax.xml.transform.TransformerException
{

  String fmsg = XSLMessages.createXPATHMessage(msg, args);

  // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, 
  //                                      m_support.ERROR,
  //                                      null, 
  //                                      null, fmsg, 0, 0);
  // if(shouldThrow)
  {
    throw new XPathException(fmsg, this);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:25,代码来源:XObject.java

示例14: setRoot

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 * Set the root node of the TreeWalker.
 * (Not part of the DOM2 TreeWalker interface).
 *
 * @param root The context node of this step.
 */
public void setRoot(int root)
{
  // %OPT% Get this directly from the lpi.
  XPathContext xctxt = wi().getXPathContext();
  m_dtm = xctxt.getDTM(root);
  m_traverser = m_dtm.getAxisTraverser(m_axis);
  m_isFresh = true;
  m_foundLast = false;
  m_root = root;
  m_currentNode = root;

  if (DTM.NULL == root)
  {
    throw new RuntimeException(
      XSLMessages.createXPATHMessage(XPATHErrorResources.ER_SETTING_WALKER_ROOT_TO_NULL, null)); //"\n !!!! Error! Setting the root of a walker to null!!!");
  }

  resetProximityPositions();
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:26,代码来源:AxesWalker.java

示例15: previousNode

import org.apache.xalan.res.XSLMessages; //导入依赖的package包/类
/**
 *  Returns the previous node in the set and moves the position of the
 * iterator backwards in the set.
 * @return  The previous <code>Node</code> in the set being iterated over,
 *   or<code>DTM.NULL</code> if there are no more members in that set.
 * @throws DOMException
 *    INVALID_STATE_ERR: Raised if this method is called after the
 *   <code>detach</code> method was invoked.
 * @throws RuntimeException thrown if this NodeSetDTM is not of 
 * a cached type, and hence doesn't know what the previous node was.
 */
public int previousNode()
{

  if (!m_cacheNodes)
    throw new RuntimeException(
      XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null)); //"This NodeSetDTM can not iterate to a previous node!");

  if ((m_next - 1) > 0)
  {
    m_next--;

    return this.elementAt(m_next);
  }
  else
    return DTM.NULL;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:28,代码来源:NodeSetDTM.java


注:本文中的org.apache.xalan.res.XSLMessages类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。