Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to find a substring in XML-lookslike string?

843789May 12 2010 — edited May 13 2010
Hi,

I have a question and wondering if anyone can help me with it.

We have Java tool that does a string replacement inside another string (that is actually an XML request). It works fine when searching for a simple substring (that exists within 1 line of the XML string).

But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. And I'm not sure what is wrong or (more importantly) how to make it work.

There is no return or new-line chars seen in the XML request.

To make it more clear - here is what I have and trying to do:

<a>
<a>
<b>
<c>
<d> </d>
<c>
<c>
</c>
</c>
</c>
</b>
</a>
</a>

If I'll seach for either <c> OR </c> OR <d> </d> it all works fine ... BUT if Itry to find

</c>
</b>

which will be copied directly from the XML request and past into field - thus it will look like this (horisontal line instead of vertical) </c> </b> - it does not work
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2010
Added on May 12 2010
3 comments
508 views