How to get the attribute value from getLead Java
I used the getLead sample code. The challenge is that the API gives me back the lead as an JAXBElement. I want to get the attribute value of that JAXBElement.
For example: I want to get the first name value of a lead, say Jack, as a String, and store it as a Java varible so I can put them though to SQL server using JDBC.
JAXBContext context = JAXBContext.newInstance(SuccessGetLead.class);
Marshaller m = context.createMarshaller() ;
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
//m.marshal(result, System.out);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder() ;
Document doc = db.newDocument() ;
m.marshal(r, doc);
//System.out.println(doc.hasAttributes()) ;
m.marshal(r, System.out);
The bold part I was trying to marshall the JAXBElement to a Node. But unfornately the node "doc" i have got didn't have anything in it whatsoever.
Any other approaches? Any help?
Thanks a lot.