Skip to Content
0
Former Member
Jun 30, 2006 at 07:17 AM

XML with whitespace over mailadapter - howto delete? JAVA

24 Views

hello together,

we will receive xml messages over mailadapter. normally the communication partner sends the messages in a good format (no whitespaces between tags). but sometimes it is a bad format like this (caused by outlook preformatting maybe) :

<tag1>

...<tag1.1></tag1.1>

...<tag1.2></tag1.2>

</tag1>

the points '.' will be symbols for blanks or other whitespaces between end-tag of previous node(</tag1.1>) and start-tag(<tag1.2>) of current node in the message. and that is the problem (wrong working of java file).

the difference to a good file:

<tag1><tag1.1></tag1.1><tag1.2></tag1.2></tag1>

the internet browser will show it in xml formatted tags with '+' and '-' and if we have a look at the source code we will find a 'good' file.

so my question: how can i delete the whitespaces between closing and opening tags in java? do anybody know a standard java function to handle this problem?

thanks a lot

alex