I have just started using XMLBeans.
The sample program is as such
import org.apache.xmlbeans.XmlOptions;
import org.tempuri.addressDetails.AddressDetailsDocument;
import org.tempuri.addressDetails.AddressDetailsDocument.AddressDetails;
import org.tempuri.addressDetails.*;
import javax.xml.transform.stream.*;;
public class PO {
public PO() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
XmlOptions xmlOptions;
AddressDetailsDocument myDoc;
myDoc = AddressDetailsDocument.Factory.newInstance();
AddressDetails myDetails;
myDetails = myDoc.addNewAddressDetails();
myDetails.setName("Laurence Moroney");
myDetails.setAddress1("123 Beverly Hills");
myDetails.setAddress2("Los Angeles, CA");
myDetails.setEmail("[EMAIL PROTECTED]");
myDetails.setZIP("11590");
xmlOptions = new XmlOptions();
//Requests use of whitespace for easire reading
xmlOptions.setSavePrettyPrint();
//Requests that nested levels of the xml document to be
indented by
//multiple of 4 whitespace characters
xmlOptions.setSavePrettyPrintIndent(4);
String xmlStr = myDoc.xmlText(xmlOptions);
//Writes the current state of the LatLong element to a standard
ouptut stream
System.out.println("XML Instance Document is : \n\n\n" + xmlStr
);
}
}
I receive this errorjava.lang.NoClassDefFoundError:
javax/xml/stream/XMLStreamException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1655)
at java.lang.Class.getMethod0(Class.java:1901)
at java.lang.Class.getMethod(Class.java:984)
at org.apache.xmlbeans.XmlBeans.buildMethod(XmlBeans.java:174)
at org.apache.xmlbeans.XmlBeans.buildNodeMethod(XmlBeans.java:195)
at
org.apache.xmlbeans.XmlBeans.buildNodeToCursorMethod(XmlBeans.java:232)
at org.apache.xmlbeans.XmlBeans. (XmlBeans.java:131)
at
org.tempuri.addressDetails.AddressDetailsDocument$Factory.newInstance(Unknown
Source)
at PO.main(PO.java:24)
Exception in thread "main"
I have included the following JARs in the classpath
xbeans.jar
xerces.jar
AddressDetails.jar
xercesImpl.jar
xml-apis.jar
Can someone help me with this problem? Thanks
--
Sent from the Axkit - Users forum at Nabble.com:
http://www.nabble.com/XMLBeans-help-requested-t736076.html#a1927092