Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Examples/SDO/SdoStatic

< EclipseLink‎ | Examples‎ | SDO
Revision as of 13:41, 22 October 2007 by Unnamed Poltroon (Talk)

// Initialize the the metadata
FileInputStream xsdInputStream = new FileInputStream("../Resource/bin/Customer.xsd");
XSDHelper.INSTANCE.define(xsdInputStream, null);

// Unmarshal the XML document
FileInputStream xmlInputStream = new FileInputStream("../Resource/bin/Customer-data.xml");
XMLDocument xmlDocument = XMLHelper.INSTANCE.load(xmlInputStream);
CustomerType customer = (CustomerType) xmlDocument.getRootObject();

// Modify the Java object
PhoneNumber phoneNumber = (PhoneNumber) DataFactory.INSTANCE.create("urn:customer-
example", "phone-number");
phoneNumber.setNumberType("home");
phoneNumber.setValue("(613) 555-3333");
customer.getContactInfo().getPhoneNumber().add(phoneNumber);

// Marshal the Java object
XMLHelper.INSTANCE.save(xmlDocument, System.out, null);

Back to the top