Simple XML Framework - Adding XSI Location in JAVA -
issue: no annotation provided adding xsi location root. stackoverflow question detailed same problem in c#. i'm not quite sure how covert on java. need update xml in flat file , thought of using string manipulation add xsi locations hoping there might cleaner approach.
reference question: c# stackoverflow same issue
sample xml:
<?xml version="1.0" encoding="utf-8"?> <ns0:mysample xmlns:ns0="someurl" xsi:schemalocation="someotherurl"> <othertag/> </ns0:mysample>
since schemalocation attribute , not namespace can parse using @attribute annotation.
@attribute private string schemalocation;
do not forget declare namespace of root element:
@namespace(prefix="xsi", reference="http://www.w3.org/2001/xmlschema-instance"),
this worked fine me.
Comments
Post a Comment