Hi,
I am trying to parse some data which is edited with a rich text editor
(FCKeditor)
When I se scandinavian characters, they are converted to html encoded
version by the FCK editor
For example:
"Å" becomes "Å"
"Ø" becomes "Ø"
etc
This content is then sent to the SAX parser as a StringBuffer (sr):
mySaxParser.parse( new InputSource( sr), this);
But with the scandinavian characters I get parsing errors. The input
string:
"Å test"
is converted to
"Å test"
by the FCK editor
And then I get this error from the SAX parser:
WARNING: error parsing text: Å test
org.xml.sax.SAXParseException: The entity "Aring" was referenced, but
not declared.
Is there perhaps some way I should escape the ampersand character?
Or what can I do with the data in the StringBuffer above so that the
parsing will work fine?
Regards, PML
kebabkongen@hotmail.com - 23 Oct 2006 09:17 GMT
Hi again,
I've registered a couple of problems with my post:
(the html coding was rendered as the HTML output, not as the code I
wrote... ;) )
It was supposed to be:
<pre>
"Å" becomes "Å"
"Ø" becomes "Ø"
etc
...and...
But with the scandinavian characters I get parsing errors. The input
string:
"Å test"
is converted to
"Å test"
by the FCK editor
And then I get this error from the SAX parser:
WARNING: error parsing text: Å test
</pre>
BTW: this is weird;
in preview mode, the post looks fine, but when posted, it seems as if
the coding is rendered as HTML instead as the code I see in preview
mode...
Could it be a bug in google groups? Or how should you post HTML source
code without it being rendered?
Regards, PML
kebabkongen@hotmail.com - 23 Oct 2006 09:20 GMT
...not again...?
Tring once more:
"Å" becomes "&Aring;"
"Ø" becomes "&Oslash"
etc
...and...
But with the scandinavian characters I get parsing errors. The input
string:
"Å test"
is converted to
"&Aring test"
by the FCK editor
And then I get this error from the SAX parser:
WARNING: error parsing text: &Aring; test
org.xml.sax.SAXParseException: The entity "Aring" was referenced, but
not declared.
-PML
Tor Iver Wilhelmsen - 23 Oct 2006 16:34 GMT
> org.xml.sax.SAXParseException: The entity "Aring" was referenced, but
> not declared.
You need to tell SAX to ignore unknown entities by adding a handler
for them and let the handler just put the unparsed entity onto
whatever destination you output to. Look at the DTDHandler interface.