I\'m working on a project that has no schema and I have to parsing the xml response manually. My problem is i can\'t get some value using the xml annotation.
For exa
The fact is autn - is only prefix, not namespace. For correct processing of the XML document, namespace must be declared.
Right namespace declaration:
QUERY
SUCCESS
7
You also need to change the annotation:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "responsedata")
public class ResponseData {
@XmlElement(name = "numhits",namespace = "http://namespace.here")
private String numhits;
@XmlElement(name = "totalhits")
private String totalhits;
}
And finnaly advice for you. If you have a xsd scheme for this xml document, use the XJC utilit for java code generation.
http://docs.oracle.com/javaee/5/tutorial/doc/bnbah.html