javax.xml.transform.SourceLocator#getLineNumber ( )源码实例Demo

下面列出了javax.xml.transform.SourceLocator#getLineNumber ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk1.8-source-analysis   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码2 项目: TencentKona-8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码3 项目: mycore   文件: MCRErrorListener.java
public static String getMyMessageAndLocation(TransformerException exception) {
    SourceLocator locator = exception.getLocator();
    StringBuilder msg = new StringBuilder();
    if (locator != null) {
        String systemID = locator.getSystemId();
        int line = locator.getLineNumber();
        int col = locator.getColumnNumber();
        if (systemID != null) {
            msg.append("SystemID: ");
            msg.append(systemID);
        }
        if (line != 0) {
            msg.append(" [");
            msg.append(line);
            if (col != 0) {
                msg.append(',');
                msg.append(col);
            }
            msg.append("]");
        }
    }
    msg.append(": ");
    msg.append(exception.getMessage());
    return msg.toString();
}
 
源代码4 项目: JDKSourceCode1.8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码5 项目: openjdk-8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码7 项目: Bytecoder   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码8 项目: openjdk-jdk9   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码9 项目: hottub   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码10 项目: openjdk-8-source   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the node
 * passed as argument. If a node set is passed as argument, the line
 * number of the first node in the set is returned.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return -1;

  Node node = nodeList.item(0);
  int nodeHandler = ((DTMNodeProxy)node).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)node).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码11 项目: jdk1.8-source-analysis   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码12 项目: TencentKona-8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码13 项目: jdk8u60   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码14 项目: JDKSourceCode1.8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码15 项目: openjdk-8   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码17 项目: Bytecoder   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码18 项目: openjdk-jdk9   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码19 项目: hottub   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}
 
源代码20 项目: openjdk-8-source   文件: NodeInfo.java
/**
 * <code>lineNumber</code> returns the line number of the current
 * context node.
 *
 * NOTE: Xalan does not normally record location information for each node.
 * To obtain it, you must set the custom TrAX attribute
 * "http://xml.apache.org/xalan/features/source_location"
 * true in the TransformerFactory before generating the Transformer and executing
 * the stylesheet. Storage cost per node will be noticably increased in this mode.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return an <code>int</code> value. This may be -1 to indicate that the
 * line number is not known.
 */
public static int lineNumber(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getLineNumber();
  else
    return -1;
}