-1

I have xml which has value as .. It throwing exception while unmarshal using JAXB.. Error - javax.xml.bind.UnmarshalException:The element type "DB" must be terminated by the matching end-tag ""

xml string -

<Employee>
<source><DB></source>
</Employee>

P.S.- Here the DB is value, not tag

Any solution to handle it?

shan
  • 1
  • 1
  • The problem is that the XML is not *well-formed*. A conventional (spec compliant) XML parser won't handle it. See the duplink for possible approaches to solving this. (The best solution is to fix the XML ... or whatever produces it.) – Stephen C Feb 02 '22 at 14:43

1 Answers1

3

If <DB> is a value, then the String should look like

<Employee>
<source><![CDATA[<DB>]]></source>
</Employee>

or

<Employee>
<source>&lt;DB&gt;</source>
</Employee>
nquincampoix
  • 508
  • 1
  • 4
  • 17