code: static public XObject create(Object val)
    {
  
      XObject result;
  
      if (val instanceof XObject)
      {
        result = (XObject) val;
      }
      else if (val instanceof String)
      {
        result = new XString((String) val);
      }
      else if (val instanceof Boolean)
      {
        result = new XBoolean((Boolean)val);
      }
      else if (val instanceof Double)
      {
        result = new XNumber(((Double) val));
      }
      else
      {
        result = new XObject(val);
      }
  
      return result;
    }
docs: Create the right XObject based on the type of the object passed.  This
  function can not make an XObject that exposes DOM Nodes, NodeLists, and
  NodeIterators to the XSLT stylesheet as node-sets.
  
  @param val The java object which this object will wrap.
  
  @return the right XObject based on the type of the object passed.