Reputation: 217
I have to write some java code in xml file which will be autogenerated.
The dtd is third party so I cannot modify that.body tag declaration looks like that.
The code that I have to write looks something like in java : List <String > valueList = new ArrayList<>();
I have tried couple of things as below: List <String > valueList = new ArrayList<>();
List <String > valueList = new ArrayList<>();
But I am getting:org.xml.sax.SAXParseException; The content of elements must consist of well-formed character data or markup.
Any ideas what I am doing wrong .
I have to write java code in xml there is no workaround for that. If nothing works I have to drop generics use.
Any suggestion ?
Upvotes: 0
Views: 299
Reputation: 25054
In your examples, you've escaped the first left angle bracket (and the first right angle bracket, which is nice and symmetrical but not necessary). But you haven't escaped the second. The string
List <String > valueList = new ArrayList<>();
is not allowed as PCDATA content, because it contains an unescaped left angle bracket. Try
List <String > valueList = new ArrayList<>();
Upvotes: 1