File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes remove strange characters in xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "remove strange characters in xml" Watch "remove strange characters in xml" New topic

remove strange characters in xml

raviraj biliyannara

Joined: Oct 17, 2005
Posts: 1

I need to remove strange characters in my xml file. Am using transformation method for parsing. While parsing process fails if it encounters strange characters like spaces(It looks like this... )
I will passing 3 parameters to the method (input file, outfile, xslRules)
Am using Transformer class and XALAN.
XML looks lik this and I need the same out put straucture.

<note_author>Viola Grantham</note_author>
<note_message> Rule 182 clerical duties were performed by paralegal; system unable to differentiate. Rule 178 Wal-Mart requires billing every 30 days. Mileage billed appropriately.</note_message>
<file_author>Viola Grantham</file_author>

I will post the code if you want......-

Any help will be highly apprecited.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Not all characters are valid within an XML file. Maybe the ones in question -whichever they are, it's not clear from your post- are not? If so, they need to be enclosed in CDATA sections.
(As an aside, "parsing fails" is not an adequate description of a problem. The full stack trace would be the minimum information required to start investigating.)
I agree. Here's the link:
subject: remove strange characters in xml
It's not a secret anymore!