Chaitanya Athaley
Chaitanya Athaley

Reputation: 3

How to Handle colon(:) in Attribute in JAXB?

<Item lims:fid="1174566" lims:id="1174566"><Text>Combat 18 (C18)</Text></Item></List><HistoricalNote><HistoricalNoteSubItem lims:inforce-start-date="2018-05-23" lims:fid="694437" lims:id="694437">

i want to get value of Attribute lims:id="1174566 but it did not read the value

@XmlAttribute(name="lims:id")
private String id="";

please help me ...

Upvotes: 0

Views: 349

Answers (1)

Ralph L&#246;we
Ralph L&#246;we

Reputation: 424

The part before the colon usually defines a namespace in xml. You need to define it in your root tag and the specify it in your Tag.

<Item xmlns:lims="http://your.domain.com/xml/lims" lims:fid="1174566" lims:id="1174566">
    <Text>Combat 18 (C18)</Text>
</Item>

JAXB:

@XmlAttribute(name="id", namespace="http://your.domain.com/xml/lims")
private String id="";

Upvotes: 1

Related Questions