Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Himanhsu Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I am getting SAXParser error for Unicode: 0x0. I think this is the null character. Right?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult for a "beginning" question. Moving thread.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I have stopped using it but how about existing files.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
I am still waiting for its resolution. Please help.
 
W Fay
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic