Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
PurchaseOrder.java - JAXB Java Example Class
What would the Java class look like, if I want to map the PurchaseOrder.xsd XML schema to Java data objects based on JAXB API?
✍: FYIcenter.com
If you apply the mapping rules given in the JAXB API specification
on the PurchaseOrder.xsd XML schema given in the previous tutorial,
you will get a Java class similar to the following:
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.List;
public class PurchaseOrderType {
USAddress getShipTo(){...}
void setShipTo(USAddress){...}
USAddress getBillTo(){...}
void setBillTo(USAddress){...}
String getComment(){...}
void setComment(String){...}
Items getItems(){...}
void setItems(Items){...}
XMLGregorianCalendar getOrderDate()
void setOrderDate(XMLGregorianCalendar)
};
public class USAddress {
String getName(){...}
void setName(String){...}
String getStreet(){...}
void setStreet(String){...}
String getCity(){...}
void setCity(String){...}
String getState(){...}
void setState(String){...}
int getZip(){...}
void setZip(int){...}
static final String COUNTRY=”USA”;
};
public class Items {
public class ItemType {
String getProductName(){...}
void setProductName(String){...}
int getQuantity(){...}
void setQuantity(int){...}
float getUSPrice(){...}
void setUSPrice(float){...}
String getComment(){...}
void setComment(String){...}
XMLGregorianCalendar getShipDate();
void setShipDate(XMLGregorianCalendar);
String getPartNum(){...}
void setPartNum(String){...}
};
List<Items.ItemType> getItem(){...}
}
public class ObjectFactory {
Object newInstance(Class javaInterface){...}
PurchaseOrderType createPurchaseOrderType(){...}
USAddress createUSAddress(){...}
Items createItems(){...}
Items.ItemType createItemsItemType(){...}
JAXBElement<PurchaseOrderType> createPurchaseOrder(PurchaseOrderType){...}
JAXBElement<String> createComment(String value){...}
}
⇒ What Is XJC (XML to Java Compiler)
⇐ PurchaseOrder.xsd - XML Schema Example for JAXB
2018-05-19, ∼1676🔥, 0💬
Popular Posts:
What JAR files are required to run sax\Writer.java provided in the Apache Xerces package? 1 JAR file...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
xml-commons External Source Code Files are provided in the source package file, xml-commons-external...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
What Is commons-lang3-3.1.jar? commons-lang3-3.1.jar is the JAR file for Apache Commons Lang 3.1, wh...