package componet;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import java.util.Properties;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
public class Canvas {
private Connection conn = null;
private Statement stmt = null;
private ResultSet rs = null;
public Canvas() {
}
@WebMethod
@Oneway
public void SetLayout(String msg){
try {
Document doc = DocumentHelper.parseText(msg);
Element root1 = doc.getRootElement();
Iterator it = root1.elements().iterator();
while(it.hasNext()){
Element info = (Element)it.next();
System.out.print(info.attribute("type").getValue());
System.out.print(info.attribute("ID").getValue());
System.out.print(info.attribute("title").getValue());
System.out.print(info.attribute("x").getValue());
System.out.print(info.attribute("y").getValue());
System.out.print(info.attribute("width").getValue());
System.out.print(info.attribute("height").getValue());
System.out.print(info.attribute("csub").getValue());
System.out.println();
}
} catch (DocumentException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Canvas obj = new Canvas();
String str = "<foc>
<item type = \"MultiButtonPanel \" ID = \"window1 \" title = \"window1 \" x = \"531 \" y = \"256 \" width = \"230 \" height = \"86 \" csub = \"0 \"/>
<item type = \"MultiButtonPanel \" ID = \"window2 \" title = \"window2 \" x = \"231 \" y = \"226 \" width = \"260 \" height = \"126 \" csub = \"1 \"/>
</foc>";
obj.SetLayout(str);
}
}
运行结果:
MultiButtonPanel window1 window1 531 256 230 86 0
MultiButtonPanel window2 window2 231 226 260 126 1
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import java.util.Properties;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@WebService(name = "MyWebService1", serviceName = "MyWebService1", portName = "MyWebService1SoapHttpPort")
public class Canvas {
private Connection conn = null;
private Statement stmt = null;
private ResultSet rs = null;
public Canvas() {
}
@WebMethod
@Oneway
public void SetLayout(String msg){
try {
Document doc = DocumentHelper.parseText(msg);
Element root1 = doc.getRootElement();
Iterator it = root1.elements().iterator();
while(it.hasNext()){
Element info = (Element)it.next();
System.out.print(info.attribute("type").getValue());
System.out.print(info.attribute("ID").getValue());
System.out.print(info.attribute("title").getValue());
System.out.print(info.attribute("x").getValue());
System.out.print(info.attribute("y").getValue());
System.out.print(info.attribute("width").getValue());
System.out.print(info.attribute("height").getValue());
System.out.print(info.attribute("csub").getValue());
System.out.println();
}
} catch (DocumentException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Canvas obj = new Canvas();
String str = "<foc>
<item type = \"MultiButtonPanel \" ID = \"window1 \" title = \"window1 \" x = \"531 \" y = \"256 \" width = \"230 \" height = \"86 \" csub = \"0 \"/>
<item type = \"MultiButtonPanel \" ID = \"window2 \" title = \"window2 \" x = \"231 \" y = \"226 \" width = \"260 \" height = \"126 \" csub = \"1 \"/>
</foc>";
obj.SetLayout(str);
}
}
运行结果:
MultiButtonPanel window1 window1 531 256 230 86 0
MultiButtonPanel window2 window2 231 226 260 126 1