Hi Simon, One obvious thing you could try to shrink the size of Xerces2's xercesImpl.jar is to compress the jarfile. By default it comes uncompressed--I'd be curious to know by what percentage compression decreases its size.
If you must use JAXP though I don't think you'll have much luck excluding Xerces2 classes. The reason is that JAXP pulls in Xerces's DOM implementation which pulls in our serialization code which pulls in our HTML and WML DOM support... If you wanted to use XNI though it would be really interesting to se just how small you could go; my guess is that you could get yourself a very optimized jarfile if you went down this road (though I don't think anyone has tried unfortunately). Hope that helps, Neil Neil Graham XML Parser Development IBM Toronto Lab Phone: 905-413-3519, T/L 969-3519 E-mail: [EMAIL PROTECTED] "Simon McClenahan" <[EMAIL PROTECTED]> on 02/08/2002 12:19:18 PM Please respond to [EMAIL PROTECTED] To: "xml. apache. org General (E-mail)" <[EMAIL PROTECTED]> cc: Subject: Crimson questions 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] --------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]