• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Removing tab character(^I) and null character Unicode: 0x0 from configuration XML file.

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am struggling to remove these junk characters from my XML.
What is the best way to it? I have already tried java programs and some unicode editors.

Please help.

Thanks
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If they really are tab and the NULL character, in Java these are '\t' and '\0'.
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting SAXParser error for Unicode: 0x0. I think this is the null character. Right?
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult for a "beginning" question. Moving thread.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like a job for some sort of custom extension of java.io.FilterInputStream that would sit between your source and your XML parser while deleting illegal characters.

What is the source of this XML? Do you have any idea why it mixes these illegal characters in?

Bill
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sure not how these characters coming into my configuration XML. One common pattern I noticed that if I edit XML in Weblogic Workshop this problem comes. So what is the solution? Read this XML in java class, remove all the characters and again write it in file?
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you should stop using Workshop to edit the files.
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have stopped using it but how about existing files.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you reading the XML files using a different character encoding setting than what the actual character encoding of the files is?

Make sure that if a file is for example encoded using UTF-8, you're reading it as an UTF-8 file. If you'd use a wrong character encoding to read the file, you could get strange errors like you describe.
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XML is read by JAXB SaxParser while deploying the ear in WebLogic server. I am using VI editor to remove ^I but not able to identify null characters.
 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am still waiting for its resolution. Please help.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you should run your existing files through some kind of filter program like the one suggested here so the bad characters are removed...
 
reply
    Bookmark Topic Watch Topic
  • New Topic