xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon McClenahan" <simon.mcclena...@stellent.com>
Subject RE: Crimson questions
Date Fri, 08 Feb 2002 22:20:41 GMT


> -----Original Message-----
> From: Edwin Goei [mailto:edwingo@sun.com]

> The serialization interface you are using will tie your app 
> to Crimson. 
> Another way is to use javax.xml.transform, but that would conflict w/
> keeping your app small.  Another option is to require running 
> on JDK 1.4
> which includes JAXP within it so you would not need to bundle anything
> w/ your app.  Also see the JAXP FAQ at
> http://xml.apache.org/~edwingo/jaxp-faq.html#output for more 
> info.  That
> page also has pointers to other non-Apache parsers.


I can create a serialization utility class for each parser, but only
distribute the one parser that is suitable, right?

The only other parser is Aelfred which does not support DOM. What do
applet developers use for XML parsing? Obviously not JAXP/DOM !




> If you or anyone else wants to figure it out, I'd start looking at the
> code in org/apache/crimson/tree/ElementNode and ElementNode2.java.


Thanks for the pointer, I figured it out :-) For future reference:


switch (myNodeType) {
	case Node.DOCUMENT_NODE :
		 ((XmlDocument) aNode).write(myStringWriter,
XMLUtils.ENCODING_UTF_8);
		break;
	case Node.ELEMENT_NODE :
		 ((ElementNode) aNode).write(myStringWriter);
		break;
	default :
		String myMsg = "Serialization not supported for DOM Node
" + aNode.toString();
		throw new RuntimeException(myMsg);
}


So now I at least support two specific Node types. The node
implementation base classes ParentNode and NodeBase are package-private,
which is where the public writeChildrenXml() methods are, but I have to
cast on a case basis instead because of the package scope. That sucks.

cheers,
	Simon


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message