Java Reference
In-Depth Information
auth = el.getValue();
LOGGER.debug("DOM AUTH: " + auth);
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (SOAPException se) {
se.printStackTrace();
} catch (JAXBException je) {
je.printStackTrace();
}
return auth;
}
private static Document marshalCC(final CreditCard card)
throws JAXBException, SAXException {
Document doc = null;
try {
Class[] clazz = {CreditCard.class};
JAXBContext ctx = JAXBContext.newInstance(clazz);
String ns = "http://ns.soacookbook.com/credit";
QName qName = new QName(ns, "creditCard", "");
JAXBElement<CreditCard> root =
new JAXBElement<CreditCard>(
qName, CreditCard.class, card);
Marshaller m = ctx.createMarshaller();
SchemaFactory sf = SchemaFactory.newInstance(
XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(
new StreamSource(new File(schemaFile)));
m.setSchema(schema);
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.newDocument();
m.marshal(root, doc);
LOGGER.debug("DOM object has elements: " +
doc.getChildNodes().getLength());
Search WWH ::




Custom Search