Forum Discussion
1priyanka
16 years agoOccasional Contributor
Hello Allen,
Thanks for response n suggestion :-)
as suggested by you here
>>>
actually the problem is more intresting here as I already tried the method above suggested by you and yeah I did debugging as well but my problem is in this chunk of code
function Class1()
{
var ws=0
var pi=0;
var dc=0;
var cc=0;
var ac=0;
var et=0;
var el=0;
var xd=0;
//Read a doc
textReader=dotNET["System_Xml" ]["XmlTextReader"]["zctor_11"] ("C:\\Documents and Settings\\priyankS\\Desktop\\ KBT.xml");
//Read until end of file
while(textReader["Read"]())
{
var nType=textReader["NodeType"];
//if node type use a declaration
if(nType==dotNET["System_Xml"] ["XmlNodeType"][" XmlDeclaration"])
{
Log["Message"]("Declaration:"+ textReader["Name"])
Log["Message"]("Hi")
xd=xd+1;
}
the value in" if(nType==dotNET["System_Xml"] ["XmlNodeType"][" XmlDeclaration"])"
both the side is same i.e" XmlDeclaration" type of object still the "==" equal to sign comparison gives false on debugging henceforth the control dont goes inside this loop.
I don't know how come when both the side same value come on debugging then still it goes false.
i request you to just run the code once at yours end and see the debugger reponse.
"XmlDeclaration" must satisfy the loop!
and for other code reply which is:-
<<<<
the above code gives sysntax error on execution
<<<
I believe the error is caused by the following line:
var xeElementCollection = xeRootNode["Elements"]()
<<<<<<<<
I am doing here C# scripting and i dont think "." dot character will solve the problem
actually I did this coding in C# visual studio and ws trying to convert it into C# script ....
so i asked for help in doing this
anyways thnx again for help :-)
Regards
Priyanka
Thanks for response n suggestion :-)
as suggested by you here
Hi Priyanka,
>>>
it neither give any output even though it satisfies the condition ,control does not goes inside the if loop and log the message
<<<
I guess you just have a node which does not meet any of the specified
conditions in your document. You can add a Log.Message call in the loop
(e.g. Log.Message(nType)) to check all the node types. If this
suggestion does not help, I recommend that you set a breakpoint and
debug your script (see the "Debugging Tests - Overview" help topic ( http://www.automatedqa.com/
>>>
actually the problem is more intresting here as I already tried the method above suggested by you and yeah I did debugging as well but my problem is in this chunk of code
function Class1()
{
var ws=0
var pi=0;
var dc=0;
var cc=0;
var ac=0;
var et=0;
var el=0;
var xd=0;
//Read a doc
textReader=dotNET["System_Xml"
//Read until end of file
while(textReader["Read"]())
{
var nType=textReader["NodeType"];
//if node type use a declaration
if(nType==dotNET["System_Xml"]
{
Log["Message"]("Declaration:"+
Log["Message"]("Hi")
xd=xd+1;
}
the value in" if(nType==dotNET["System_Xml"]
both the side is same i.e" XmlDeclaration" type of object still the "==" equal to sign comparison gives false on debugging henceforth the control dont goes inside this loop.
I don't know how come when both the side same value come on debugging then still it goes false.
i request you to just run the code once at yours end and see the debugger reponse.
"XmlDeclaration" must satisfy the loop!
and for other code reply which is:-
<<<<
the above code gives sysntax error on execution
<<<
I believe the error is caused by the following line:
var xeElementCollection = xeRootNode["Elements"]()
You missed the "." character between "xeRootNode["Elements"]()" and "GetEnumerator();"
<<<<<<<<
I am doing here C# scripting and i dont think "." dot character will solve the problem
actually I did this coding in C# visual studio and ws trying to convert it into C# script ....
so i asked for help in doing this
anyways thnx again for help :-)
Regards
Priyanka