Date date=new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
String datetime=format.format(date).replace("GMT", "");
String AppKey="aedbc";
String AppSecret="2d442";
String Sign=(AppKey+datetime+AppSecret);
Document requestDoc = DocumentHelper.createDocument();
//最外层<Request>包括<Datetime>和<Authorization>
Element root = requestDoc.addElement("Request");
Element datetimeElement = root.addElement("Datetime");
datetimeElement.addText(datetime);
//<Authorization>这层包含<AppKey>和<Sign>这两层
Element AuthorizationElement = root.addElement("Authorization");
AuthorizationElement.addElement("AppKey").addText(AppKey);
AuthorizationElement.addElement("Sign").addText(Sign);
String xml=root.asXML();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
String datetime=format.format(date).replace("GMT", "");
String AppKey="aedbc";
String AppSecret="2d442";
String Sign=(AppKey+datetime+AppSecret);
Document requestDoc = DocumentHelper.createDocument();
//最外层<Request>包括<Datetime>和<Authorization>
Element root = requestDoc.addElement("Request");
Element datetimeElement = root.addElement("Datetime");
datetimeElement.addText(datetime);
//<Authorization>这层包含<AppKey>和<Sign>这两层
Element AuthorizationElement = root.addElement("Authorization");
AuthorizationElement.addElement("AppKey").addText(AppKey);
AuthorizationElement.addElement("Sign").addText(Sign);
String xml=root.asXML();
System.out.println(xml);
//输出的这个结果为<Request><Datetime>2017-05-18T16:13:48.499+08:00</Datetime><Authorization><AppKey>7d09943f69714b5582195ecfea7aedbc</AppKey><Sign>7d09943f69714b5582195ecfea7aedbc2017-05-18T16:13:48.499+08:002d442d42f7094b918de03f86dedc7129</Sign></Authorization></Request>