FileDocCategorySizeDatePackage
ExsltBase.javaAPI DocJava SE 5 API2142Fri Aug 26 14:55:30 BST 2005com.sun.org.apache.xalan.internal.lib

ExsltBase

public abstract class ExsltBase extends Object
The base class for some EXSLT extension classes. It contains common utility methods to be used by the sub-classes.

Fields Summary
Constructors Summary
Methods Summary
protected static doubletoNumber(org.w3c.dom.Node n)
Convert the string value of a Node to a number. Return NaN if the string is not a valid number.

param
n The Node.
return
The number value of the Node

    double d = 0.0;
    String str = toString(n);
    try
    {
      d = Double.valueOf(str).doubleValue();
    }
    catch (NumberFormatException e)
    {
      d= Double.NaN;  		
    }
    return d;
  
protected static java.lang.StringtoString(org.w3c.dom.Node n)
Return the string value of a Node

param
n The Node.
return
The string value of the Node

    if (n instanceof DTMNodeProxy)
  	 return ((DTMNodeProxy)n).getStringValue();
    else
    {
      String value = n.getNodeValue();
      if (value == null)
      {
        NodeList nodelist = n.getChildNodes();
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < nodelist.getLength(); i++)
        {
          Node childNode = nodelist.item(i);
          buf.append(toString(childNode));
        }
        return buf.toString();
      }
      else
        return value;
    }