aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "remove strange characters in xml" Watch "remove strange characters in xml" New topic
Author

remove strange characters in xml

raviraj biliyannara
Greenhorn

Joined: Oct 17, 2005
Posts: 1
Hi,

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.

<client_note>
<note_id>14233</note_id>
<note_parentid></note_parentid>
<note_author>Viola Grantham</note_author>
<note_author_id>6093</note_author_id>
<note_author_org_id>LST001</note_author_org_id>
<note_date>10/11/2005</note_date>
<note_time>14:30:51</note_time>
<note_subject>receipts</note_subject>
<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>
<note_public>TRUE</note_public>
<attachment>
<file_id>3004</file_id>
<file_name>222507.PDF</file_name>
<file_size>559991</file_size>
<file_type>RECEIPTS</file_type>
<file_created_date>10/11/2005</file_created_date>
<file_created_time>14:30:51</file_created_time>
<file_author>Viola Grantham</file_author>
<file_deleted_date></file_deleted_date>
<file_deleted_time></file_deleted_time>
<file_deleted_by_name></file_deleted_by_name>
</attachment>
</client_note>

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

Any help will be highly apprecited.



Thanks
Raviraj
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41571
    
  54
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.)


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: remove strange characters in xml