You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Brian Boyle <bb...@gmail.com> on 2008/12/10 22:42:44 UTC

Commons Configuratio - CDATA in XML

Hi,

I am loading up a XML file into and XMLConfiguration object but I am getting
an error.

org.apache.commons.configuration.ConfigurationException: Invalid byte 1 of
1-byte UTF-8 sequence.

It appears the my XML is failing to be parsed correctly because I have an
apostrophe in it. However, I have wrapped my XML values in CDATA so this
should normally prevent this from happening. Does Commons Configuration
support parsing XML tags with CDATA in them?
Here is a sample of what my XML is like

<description><![CDATA[doesn't seem to work]]></description>

Thanks

Brian

-- 
Brian Boyle
Mobile: 087 418 5215
Email: bboyle18@gmail.com

Re: Commons Configuratio - CDATA in XML

Posted by Mark Fortner <ph...@gmail.com>.
I can't tell without looking at the file, but my guess is that you have a
character in your XML that is not UTF-8.  The encoding at the top of the
file probably specifies UTF-8 as the encoding.  If you can replace the
character you should be OK.  JEdit or Eclipse should be able to point out
the offending character.  Regardless of whether the CDATA exists, most
parsers will check to see if you're using the right encoding.

Hope this helps,

Mark

On Wed, Dec 10, 2008 at 1:42 PM, Brian Boyle <bb...@gmail.com> wrote:

> Hi,
>
> I am loading up a XML file into and XMLConfiguration object but I am
> getting
> an error.
>
> org.apache.commons.configuration.ConfigurationException: Invalid byte 1 of
> 1-byte UTF-8 sequence.
>
> It appears the my XML is failing to be parsed correctly because I have an
> apostrophe in it. However, I have wrapped my XML values in CDATA so this
> should normally prevent this from happening. Does Commons Configuration
> support parsing XML tags with CDATA in them?
> Here is a sample of what my XML is like
>
> <description><![CDATA[doesn't seem to work]]></description>
>
> Thanks
>
> Brian
>
> --
> Brian Boyle
> Mobile: 087 418 5215
> Email: bboyle18@gmail.com
>



-- 
Mark Fortner

blog: http://feeds.feedburner.com/jroller/ideafactory