I want to bundle a JAXP compliant XML parser with my application, with the requirement that the jar file is as small as possible. From what I can tell, between Crimson, Xerces1 and Xerces2, I am using Crimson because of its smaller jar size. However, if there is a way to distribute Xerces2 without all the classes that I don't use so that it reduces the size of the jar, that would be preferable.
Now that I'm using Crimson, I have a technical question about serialization, and apparently this list is the only forum for Crimson discussion. I can serialize a Document fine, but I haven't figured out how to serialize any other type of DOM Node. My code is: ---------------------------------------------------------------------- public static String serializeToString(Node aNode) { String myResult = null; // Crimson implementation StringWriter myStringWriter = new StringWriter(); short myNodeType = aNode.getNodeType(); try { switch (myNodeType) { case Node.DOCUMENT_NODE : ((XmlDocument) aNode).write(myStringWriter, XMLUtils.ENCODING_UTF_8); break; default : XmlDocument myXmlDocument = (XmlDocument) aNode.getOwnerDocument(); myXmlDocument.writeChildrenXml( myXmlDocument.createWriteContext(myStringWriter, 0)); break; } } catch (IOException e) { String myMsg = "Unable to serialize DOM Node: " + e.getMessage(); throw new RuntimeException(myMsg); } myResult = myStringWriter.toString(); return myResult; } ---------------------------------------------------------------------- However, the default non-Document case returns an empty String. From what I can tell this is because Crimson does not see any children of the given DOM Node and exits early without serializing anything. Specifically, I would like to serialize an Element. Do I have to write a hack that creates a new XmlDocument, import the Element, then serialize the XmlDocument without the XML header information currently hard coded in XmlDocument.write() ? cheers, Simon --------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]