FileDocCategorySizeDatePackage
NodeInfo.javaAPI DocJava SE 6 API8371Tue Jun 10 00:22:24 BST 2008com.sun.org.apache.xalan.internal.lib

NodeInfo

public class NodeInfo extends Object
NodeInfo defines a set of XSLT extension functions to be used from stylesheets.
author
Ovidiu Predescu
since
May 24, 2001

Fields Summary
Constructors Summary
Methods Summary
public static intcolumnNumber(com.sun.org.apache.xalan.internal.extensions.ExpressionContext context)
columnNumber returns the column 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 ExpressionContext value
return
an int value. This may be -1 to indicate that the column number is not known.

    Node contextNode = context.getContextNode();
    int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
      .getSourceLocatorFor(nodeHandler);

    if (locator != null)
      return locator.getColumnNumber();
    else
      return -1;
  
public static intcolumnNumber(org.w3c.dom.NodeList nodeList)
columnNumber returns the column 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 NodeList value
return
an int value. This may be -1 to indicate that the column number is not known.

    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.getColumnNumber();
    else
      return -1;
  
public static intlineNumber(com.sun.org.apache.xalan.internal.extensions.ExpressionContext context)
lineNumber 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 ExpressionContext value
return
an int value. This may be -1 to indicate that the line number is not known.

    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;
  
public static intlineNumber(org.w3c.dom.NodeList nodeList)
lineNumber 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 NodeList value
return
an int value. This may be -1 to indicate that the line number is not known.

    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;
  
public static java.lang.StringpublicId(com.sun.org.apache.xalan.internal.extensions.ExpressionContext context)
publicId returns the public identifier of the current context node. Xalan does not currently record this value, and will return null.

param
context an ExpressionContext value
return
a String value

    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 java.lang.StringpublicId(org.w3c.dom.NodeList nodeList)
publicId 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 NodeList value
return
a String value

    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;
  
public static java.lang.StringsystemId(com.sun.org.apache.xalan.internal.extensions.ExpressionContext context)
systemId returns the system id of the current context node.

param
context an ExpressionContext value
return
a String value

    Node contextNode = context.getContextNode();
    int nodeHandler = ((DTMNodeProxy)contextNode).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy)contextNode).getDTM()
      .getSourceLocatorFor(nodeHandler);

    if (locator != null)
      return locator.getSystemId();
    else
      return null;
  
public static java.lang.StringsystemId(org.w3c.dom.NodeList nodeList)
systemId returns the system id of the node passed as argument. If a node set is passed as argument, the system id of the first node in the set is returned.

param
nodeList a NodeList value
return
a String value

    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.getSystemId();
    else
      return null;