我有一个大格式的XML文件。
<ESC>
<ATTRIBUTES>
< Some sentences of attribute node >
</ATTRIBUTES>
<SCRIPT>
<ETXML_LINE_TABTYPE>
<item>***********************************************************.</item>
<item>* Information.</item>
<item>***********************************************************.</item>
<item>* Script for test case : TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_EN.x</item>
<item>*</item>
<item>* For Sub script:</item>
<item>* 'Test case 3: Choose an Internal Order in One.Fi using external order number while transaction posting (positive case)'.</item>
<item>*</item>
<item>* Script is to Display Internal Order using external order number while Transaction Posting 'FB01'</item>
<item>* GETTAB command is being used to fetch the data from table 'COAS'. </item>
<item>*</item>
<item>*</item>
<item>* Test data related Information</item>
<item>* -----------------------------</item>
<item>* Default test data present in parameter list has been used while Scripting ( script recording & Performing Checks ).</item>
<item>*</item>
<item>* Final execution of result log: 0000037077.</item>
<item>*</item>
<item>* Preparation.</item>
<item/>
<item/> <item>**************************************************************************.</item >
<item>* End Preparation.</item>
<item>********************************************************************************.</item>
<item/>
<item/>
<item>********************************************************************************.</item>
<item>* Execution.</item>
<item>********************************************************************************.</item>
<item>* To get the 'Table Entries' from table 'COAS'.</item>
<item> GETTAB ( COAS , COAS_1 ).</item>
<item>* To display the value for the field 'External Order No'.</item>
<item> LOG ( V_EXTERNAL_ORDER_NO_FRM_TABL ).</item>
<item/>
<item>*----------------------Posting(FB01)-------------------------------------------*.</item>
<item/>
<item>* This part of Script is to Display Internal Order using external order number while Transaction Posting 'FB01'.</item>
<item>MESSAGE ( MSG_1 ).</item>
<item>* To get the name of the Title Screen.</item>
<item> GETGUI ( FB01_100_STEP_1 ).</item>
<item>* Enter the Required details and Press Enter.</item>
<item> SAPGUI ( FB01_100_STEP_2 ).</item>
<item>* Enter Amount and Tax Code.</item>
<item>* and, Press F4 help in the Order Field.</item>
<item> SAPGUI ( FB01_300_STEP_1 ).</item>
<item>* In F4 screen, enter the 'External Order Number'</item>
<item>* pop-up screen is displayed with entries like Order, Description and External Order Number and select 1st order row, press Enter.</item>
<item> SAPGUI ( FB01_200_STEP_1 ).</item>
<item>* To get the values for the field 'Order, Description and External Order No' from F4 help.</item>
<item> GETGUI ( FB01_120_STEP_1 ).</item>
<item>* Press 'Enter' button.</item>
<item> SAPGUI ( FB01_120_STEP_3 ).</item>
<item>* To get the value for the field 'Order' from Main screen.</item>
<item> GETGUI ( FB01_300_STEP_2 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_300_STEP_3 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_700_STEP_1 ).</item>
<item>* click 'Yes' button.</item>
<item> SAPGUI ( FB01_200_STEP_2 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_100_STEP_3 ).</item>
<item>ENDMESSAGE ( E_MSG_1 ).</item>
<item/>
<item>* To display the Title Screen.</item>
<item> LOG ( V_TITLE_SCREEN ).</item>
<item>* To display the 'Order' Number from F4 help.</item>
<item> LOG ( V_ORDER_NO_FROM_F4 ).</item>
<item>* To display the 'Description' from F4 help.</item>
<item> LOG ( V_DESCRIPTION_FROM_F4).</item>
<item>* To display the 'External Order no' value from F4 help.</item>
<item> LOG ( V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
<item>* To display the 'Order' Number from main screen.</item>
<item> LOG ( V_ORDER_NO_FRM_MAIN_SCREEN ).</item>
<item>********************************************************************************.</item>
<item>* End Execution.</item>
<item>********************************************************************************.</item>
<item/>
<item>********************************************************************************.</item>
<item>* Check.</item>
<item>********************************************************************************.</item>
<item>* To check name of Title screen for transaction FB01.</item>
<item> CHEVAR ( V_TITLE_SCREEN = I_TITLE_SCREEN ).</item>
<item>* To check the value for the field 'External Order No' from F4 help, which should be equal to 'External Order No' from table.</item>
<item> CHEVAR ( V_EXTERNAL_ORDER_NO_FRM_TABL = V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
<item>* To check the values for the field 'Order' number from Table, which should be equal to 'Order' no from F4 screen and Main screen.</item>
<item> CHEVAR ( ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FROM_F4 ) AND ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FRM_MAIN_SCREEN )).</item>
<item>*****************************************************************.</item>
<item>* End Check.</item>
<item>******************************************************************.</item>
</ETXML_LINE_TABTYPE>
</SCRIPT>
<PARAMETER>
<Sentences of PARAMETER tag >
</PARAMETER>
</ESC>
我想使用vb脚本验证标准检查上面的XML,如下所示。
*
的行表示,代码用没有*
符号的行表示。)这是我对上述标准的vb脚本但首先我已将XML转换为文本文件,我已经处理了文本文件,下面是文本文件的代码。
filename = "D:\Automation\o.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(filename)
fl=0
Do Until f.AtEndOfStream
strLine = f.ReadLine
if (strLine ="MESSAGE ( MSG_1 ).") then
Document.write("<br>Inside MESSAGE ")
Do until f.AtEndOfStream
strLine = f.ReadLine
if((Left(strLine,1)="*")) Then
if((Right(strLine,1)=".")) then
Document.write("<br>ERROR Found at Line No :" & f.line-1&" "& strLine)
end if
fl=1
else
if((Right(strLine,1)=".") and (fl=1))Then
fl=0
else
Document.write("<br>ERROR Found at Line No :" & f.line-1&" "& strLine)
end if
end if
Loop
end if
但现在我想要Vb脚本,它应遵循上述标准但不将XML转换为文本文件。