/// XML Http Function // function postXmlDocument (sUri, xmlDoc) {var xmlHttp = XmlHttp.create (); var async = true; xmlHttp.open ( "POST", sUri, async); xmlHttp.setRequestHeader ( "Content- type "," text / xml "); xmlHttp.setRequestHeader (" charset "," UTF-8 "); xmlHttp.onreadystatechange = function () {if (xmlHttp.readyState == 4) postHandleCallback (xmlHttp.responseText); / / Responsexml: XmlDocument} Xmlhttp.send (XmLDoc);} Servlet End code, just need to flow in XML, then directly parsing processing
SAXReader Xmlreader = new saxreader (); InputStream in = servletActionContext.getRequest (). GetInputStream (); document = XmlReader.Read; in;
Here is the traversal of the XML document
for (Iterator i = root.elementIterator (modelName); i.hasNext ();) {Element element = (Element) i.next (); Object entityIns = instanceModel (modelName); Iterator subnodes = element.elementIterator (); while (Subnodes.hasNext ()) {ELEMENT Subnode = (Element) Subnodes.next (); DynamicPopulate (Subnode.getName (), Subnode.getText (), Entityins;
}