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

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

源代码1 项目: jdk1.8-source-analysis   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码2 项目: TencentKona-8   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码3 项目: jdk8u60   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码4 项目: openjdk-jdk8u   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码5 项目: hottub   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码7 项目: openjdk-jdk9   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the node passed as
 * argument. If a node set is passed as argument, the public identifier of
 * the first node in the set is returned.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param nodeList a <code>NodeList</code> value
 * @return a <code>String</code> value
 */
public static String publicId(NodeList nodeList)
{
  if (nodeList == null || nodeList.getLength() == 0)
    return null;

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

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码8 项目: jdk1.8-source-analysis   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the current
 * context node.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return a <code>String</code> value
 */
public static String publicId(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码9 项目: TencentKona-8   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the current
 * context node.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return a <code>String</code> value
 */
public static String publicId(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码10 项目: jdk8u60   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the current
 * context node.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return a <code>String</code> value
 */
public static String publicId(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码11 项目: openjdk-jdk9   文件: ProcessXSLT.java
private static void printLocation(PrintWriter diagnosticsWriter, Throwable throwable) {
    try {
        Class<?> errorHandler =
                Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler");
        Method m = errorHandler.getMethod("printLocation", PrintWriter.class, Throwable.class);
        m.invoke(null, diagnosticsWriter, throwable);
    } catch (Throwable t) {
        SourceLocator locator = null;
        Throwable cause = throwable;

        // Try to find the locator closest to the cause.
        do {
            if (cause instanceof TransformerException) {
                SourceLocator causeLocator = ((TransformerException) cause).getLocator();
                if (null != causeLocator) {
                    locator = causeLocator;
                }
                cause = ((TransformerException) cause).getCause();
            } else if (cause instanceof SAXException) {
                cause = ((SAXException) cause).getException();
            } else {
                cause = cause.getCause();
            }
        } while (null != cause);

        if (null != locator) {
            // m_pw.println("Parser fatal error: "+exception.getMessage());
            String id = (null != locator.getPublicId())
                    ? locator.getPublicId()
                    : (null != locator.getSystemId())
                            ? locator.getSystemId() : "SystemId Unknown"; //"SystemId Unknown";

            diagnosticsWriter.print(id + "; " + "line: " + locator.getLineNumber()
                    + "; column: " + locator.getColumnNumber() + "; ");
        }
        diagnosticsWriter.print("(" + throwable + ": unknown location)");
    }
}
 
源代码12 项目: openjdk-8-source   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the current
 * context node.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return a <code>String</code> value
 */
public static String publicId(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
源代码13 项目: hottub   文件: NodeInfo.java
/**
 * <code>publicId</code> returns the public identifier of the current
 * context node.
 *
 * Xalan does not currently record this value, and will return null.
 *
 * @param context an <code>ExpressionContext</code> value
 * @return a <code>String</code> value
 */
public static String publicId(ExpressionContext context)
{
  Node contextNode = context.getContextNode();
  int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
  SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
    .getSourceLocatorFor(nodeHandler);

  if (locator != null)
    return locator.getPublicId();
  else
    return null;
}
 
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码15 项目: TencentKona-8   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码16 项目: jdk8u60   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码17 项目: JDKSourceCode1.8   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码18 项目: openjdk-jdk8u   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码19 项目: openjdk-8   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}
 
源代码20 项目: hottub   文件: DefaultErrorHandler.java
public static void printLocation(PrintWriter pw, Throwable exception)
{
  SourceLocator locator = null;
  Throwable cause = exception;

  // Try to find the locator closest to the cause.
  do
  {
    if(cause instanceof SAXParseException)
    {
      locator = new SAXSourceLocator((SAXParseException)cause);
    }
    else if (cause instanceof TransformerException)
    {
      SourceLocator causeLocator = ((TransformerException)cause).getLocator();
      if(null != causeLocator)
        locator = causeLocator;
    }
    if(cause instanceof TransformerException)
      cause = ((TransformerException)cause).getCause();
    else if(cause instanceof WrappedRuntimeException)
      cause = ((WrappedRuntimeException)cause).getException();
    else if(cause instanceof SAXException)
      cause = ((SAXException)cause).getException();
    else
      cause = null;
  }
  while(null != cause);

  if(null != locator)
  {
    // m_pw.println("Parser fatal error: "+exception.getMessage());
    String id = (null != locator.getPublicId() )
                ? locator.getPublicId()
                  : (null != locator.getSystemId())
                    ? locator.getSystemId() : XMLMessages.createXMLMessage(XMLErrorResources.ER_SYSTEMID_UNKNOWN, null); //"SystemId Unknown";

    pw.print(id + "; " +XMLMessages.createXMLMessage("line", null) + locator.getLineNumber()
                       + "; " +XMLMessages.createXMLMessage("column", null) + locator.getColumnNumber()+"; ");
  }
  else
    pw.print("("+XMLMessages.createXMLMessage(XMLErrorResources.ER_LOCATION_UNKNOWN, null)+")");
}