51Testing软件测试论坛

标题: 如何读取XML 某一node里部分内容? [打印本页]

作者: Grace    时间: 2008-4-7 11:07
标题: 如何读取XML 某一node里部分内容?
我们要测的应用程序要给用户的eMail里Notification.
This messsage is kept by XML data.
There is a registeration link in one node in this me?message.
How can I get this link?
Now I can imulately open this eMail in "app/eMails" URL.
This message format is as below:

<MANIFEST>
  <SOURCE />
  <SOURCE_TYPE>1</SOURCE_TYPE>
  <PRIORITY>0</PRIORITY>
  <MESSAGE_KEY />
  <MESSAGE_TYPE>Email Queue Message</MESSAGE_TYPE>
  <DATETIME_STAMP>3/19/2008 6:08:23 PM</DATETIME_STAMP>
  </MANIFEST>
<PAYLOAD>
<TRANSPORT_DETAILS>
  <TO_ADDRESS>"pandita1 P. napat1" <adipol@yah.com></TO_ADDRESS>
  <FROM_ADDRESS>"add update10" <support@xxxx.com></FROM_ADDRESS>
  <CC_ADDRESS />
  <SUBJECT>Invitation from your Doctor to Communicate Online</SUBJECT>
  <BODY_FORMAT>0</BODY_FORMAT>
  <SENDER_NAME />
  <RECIPIENT_NAME />
  </TRANSPORT_DETAILS>
  <MESSAGE_CONTENT>Dear pandita1 P. napat1, You may now reach me online using a secure service called xxx. I encourage you to communicate with me directly about non-urgent healthcare needs. I have set up an account on your behalf. To complete registration for this account, please click the link below. https://app.xxxx/Invite/PIMgr.aspx?token=1712BBA52D85DA Please click this link or paste it into your browser's address field. .... Learn more (take a tour). https://app.xxxx/general/onlineQuicktour/default.aspx NOTE: PLEASE DO NOT REPLY TO THIS INVITATION E-MAIL. REGISTER FOR THE SECURE SERVICE TO COMMUNICATE ONLINE WITH ME. Sincerely, add update10 If you would like to decline this invitation please click: https://app.xxxx/Invite/PIMgr.aspx?decline=1712BBA52D85DA</MESSAGE_CONTENT>
  </PAYLOAD>

数据如上所述,我要如何取得蓝色的URL Address?
任务比较急,自己以前也没接触过,请知道的朋友给点Idea. thanks

[ 本帖最后由 Grace 于 2008-4-7 11:10 编辑 ]
作者: chech28    时间: 2008-4-7 12:12
任何编程语言都行吧
先用个xml parser的包,dom什么的,弄出那个MESSAGE_CONTENT的node,
然后可以用regular expression,你自己找些特征,不会混淆的就好。
我个人建议用ruby,相当简单,remxl也比一般dom简单多了。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2