[jdom-interest] url as attribute value changes & to &
Bradley S. Huffman
hip at a.cs.okstate.edu
Sat Jul 27 09:16:31 PDT 2002
Wouldn't extending XMLOutputter and overriding escapeAttributeEntities
work in your situation?
public MyNonXMLOutputter extends XMLOutputter {
public MyNonXMLOutputter() {
setOmitDeclaration(true); // Don't want to say we're a XML
// document when we're NOT!
}
public String escapeAttributeEntities(String value) {
// Return value "as is".
return value;
}
}
Now obviously MyNonXMLOutputter doesn't output XML (because it doesn't escape
attribute values properly), but that's between you and the people you
work with :) IMHO, though, the prefered solution would be a xslt transform.
Brad
Phillip Rhodes writes:
> I understand your point, that it is invalid to have an unescaped ampersand
> as an attribute value in xml.
>
> But I'm stuck now. Looking for some ideas. I am using jdom to build a
> html page. So currently, there is no process that will unescape the
> ampersands.
>
> Are you saying write string search and replace program? This feels kind of
> wrong.
> Just hoping to get some ideas. I am going to investigate doing it in an
> xsl stylesheet after output from jdom.
More information about the jdom-interest
mailing list