This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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>
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com