Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I include dynamic data inside XML?

 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to put dynamic data inside the xml. The problem I am having is that sometimes the data contains characters that look like XML tags.

For example:
<?xml version="1.0" encoding="UTF-8"?>
<error>
at java.net.Socket.<init>(Socket.java(Compiled Code))
</error>

This will not parse since <init> looks like an XML tag without an ending tag.
Is there an easy way to handle this?
 
Kantutan Tayo
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrap it around with CDATA
i.e.
<![CDATA[

at java.asdf.<init>

]]>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic