cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aki Yoshida <elak...@googlemail.com>
Subject Re: FileUtils.getStringFromFile issue when using XML
Date Tue, 03 May 2011 13:18:47 GMT
Hi,
you are right. The normalizeCRLF() method should not add an extra
space at the begining. We can fix this particular issue.

But there is one open question, as the exact purpose (use case) of
this method is not clear to me. Why do we need this normalization
method that just removes all the CRs and LFs and replace each
space/tab character with a single space and this method is
automatically called in FileUtils.getStringFromFile()?

Does someone else wants to have other normalization options such as
doing the standard xml white space "ignore" handling or the
end-of-line handling (i.e., replacing each CRLF pair to a single LF)?

Regards, aki

2011/5/2 Tom Eastmond <tomeast@gmail.com>:
> I was using the FileUtils.getStringFromFile() method for some Camel
> testing and was receiving a SAXParseException: The processing
> instruction target matching "[xX][mM][lL]" is not allowed.].
>
> It turns out that this was due to the was due to the
> FileUtils.normalizeCRLF() method which replaces whitespace characters
> (\s) with two spaces. This method appends leading spaces to the
> contents (before the <?xml version="1.0" encoding="UTF-8"?> in this
> case) which chokes the XML parser. Would it be feasible to forgo the
> leading spaces at the start of a file in order to avoid this issue?
> I'd be happy to submit a test case/patch if this seems like a valid
> bug/fix. Please let me know if I should use another forum for this
> request.
>
> Thanks for the excellent work,
>
> Tom Eastmond
>

Mime
View raw message