Hashtable XMLDeclAttribs = new Hashtable(); XMLDeclAttribs.put("standalone", new String("no")); XMLDeclAttribs.put("version", (String) sXMLSpecVersion); toXDFOutputStream(outputstream, XMLDeclAttribs, indent);
String nodeNameString = this.classXDFNodeName;    if (newNodeNameString != null) nodeNameString = newNodeNameString;     if ((XMLDeclAttribs !=null) &&(!XMLDeclAttribs.isEmpty())) { indent = ""; writeXMLDeclToOutputStream(outputstream, XMLDeclAttribs); }   if (nodeNameString != null) {  if (sPrettyXDFOutput) writeOut(outputstream, indent);           if ( nodeNameString.equals(sXDFStructureNodeName) && !XMLDeclAttribs.isEmpty() ) nodeNameString = sXDFRootNodeName;  writeOut(outputstream,"<" + nodeNameString);  }   Hashtable xmlInfo = getXMLInfo();    ArrayList attribs = (ArrayList) xmlInfo.get("attribList");  synchronized(attribs) { for (int i = 0; i < attribs.size(); i++) { Hashtable item = (Hashtable) attribs.get(i); writeOut(outputstream, " "+ item.get("name") + "=\"" + item.get("value") + "\""); } }     ArrayList childObjs = (ArrayList) xmlInfo.get("childObjList"); String pcdata = (String) xmlInfo.get("PCDATA");  if ( childObjs.size() > 0 || pcdata != null || noChildObjectNodeName != null) {   if (nodeNameString != null) { writeOut(outputstream, ">"); if ((sPrettyXDFOutput) && (pcdata == null)) writeOut(outputstream, Constants.NEW_LINE); }   for (int i = 0; i < childObjs.size(); i++) { Hashtable item = (Hashtable) childObjs.get(i);  if (item.get("type") == Constants.LIST_TYPE) {  List objectList = (List) item.get("value");     synchronized(objectList) { Iterator iter = objectList.iterator(); while (iter.hasNext()) { BaseObject containedObj = (BaseObject) iter.next(); if (containedObj != null) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } } else if (item.get("type") == Constants.OBJECT_TYPE) { BaseObject containedObj = (BaseObject) item.get("value"); if (containedObj != null) {  synchronized(containedObj) { indent = dealWithOpeningGroupNodes(containedObj, outputstream, indent); indent = dealWithClosingGroupNodes(containedObj, outputstream, indent); String newindent = indent + sPrettyXDFOutputIndentation; containedObj.toXDFOutputStream(outputstream, new Hashtable(), newindent); } } } else {  Log.errorln("Weird error: unknown XML attribute type for item:"+item); }  }    if(pcdata != null)  { writeOut(outputstream, pcdata); };    if ( childObjs.size() == 0 && pcdata == null && noChildObjectNodeName != null) {  if (sPrettyXDFOutput) writeOut(outputstream, indent + sPrettyXDFOutputIndentation);  writeOut(outputstream, "<" + noChildObjectNodeName + "/>");  if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE);  }   if (nodeNameString != null) {  indent = dealWithClosingGroupNodes((BaseObject) this, outputstream, indent);  if (sPrettyXDFOutput && pcdata == null) writeOut(outputstream, indent);  if (!dontCloseNode) writeOut(outputstream, "</"+nodeNameString+">");  }  } else {  if (dontCloseNode) {   writeOut(outputstream, ">"); } else {  writeOut(outputstream, "/>"); }  }  if (sPrettyXDFOutput) writeOut(outputstream, Constants.NEW_LINE);
  public void toXDFOutputStream (OutputStream outputstream, String indent)  {     // prepare XMLDeclaration     Hashtable XMLDeclAttribs = new Hashtable();     XMLDeclAttribs.put("standalone", new String("no"));     XMLDeclAttribs.put("version", (String) sXMLSpecVersion);     toXDFOutputStream(outputstream, XMLDeclAttribs, indent);  }