if (lDoc == null) lDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
if (m_doc == null) { synchronized (m_instance) { if (m_doc == null) m_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } }
  public static NodeList split(String str, String pattern)  {    try    {      if (lDoc == null)        lDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();    }    catch(ParserConfigurationException pce)    {      throw new org.apache.xml.utils.WrappedRuntimeException(pce);    }        NodeSet resultSet = new NodeSet();    resultSet.setShouldCacheNodes(true);        boolean done = false;    int fromIndex = 0;    int matchIndex = 0;    String token = null;        while (!done && fromIndex < str.length())    {      matchIndex = str.indexOf(pattern, fromIndex);      if (matchIndex >= 0)      {	    token = str.substring(fromIndex, matchIndex);	    fromIndex = matchIndex + pattern.length();	  }      else      {        done = true;        token = str.substring(fromIndex);      }              Element element = lDoc.createElement("token");      Text text = lDoc.createTextNode(token);      element.appendChild(text);      resultSet.addNode(element);          }        return resultSet;  }