James,

It sounds like the best solution is the specialized factories.

ValidatingDocumentFactory for guys (even gals) who how a XML view of the
world and just want to protect themselves from bad things. And an
EncodingDocumentFactory for guys who want a more Java interpretation of
String and not break XML's view.

Slick...well to be confirmed when I actually write my
EncodingDocumentFactory.

> If a developer knows that their String may contain invalid characters then
> something like the following may be used...
>
>     // encode XML sensitive characters
>     String escapedString = DocumentHelper.encodeString( "some text > < &
> " );
>
>     // encode binary data
>     String escapedString = DocumentHelper.encodeBinary( byte[] someData );

Yes. These would be useful and would be used in the specialized Text node
class to hide this from the Java world-view guy.

> Note that if you've regular text which contains special XML
> characters like
> < > & then you can always use CDATA sections.
> For example
>
>     Element element = ...;
>     element.addCDATA( "<this contains > & special characters !" );

Yes, this it OK for special chars, but not the nasty ones :-)

Now back to the JDOM world...our current projects are based on it, so
switching now is not an option. I will have to just look on lustfully at the
features of dom4j...

Thanks,
csw


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to