SPONSORS:






User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 10 of 31
  1. #1
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parsing XML with SilkTest

    I have an XML document (not an HTML page with XML in it) that I need to parse.

    Can Silk do this? What I basically need is to get the value of any node within the XML document.

    I looked up the XMLNode class that Silk has, but that doesn't seem like it is meant for parsing an XML document.

    Has anyone done this? How?

    Thanks,




    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    Here is a function I created that looks for the >< signs to parse out data.

    MikeF

    ------------------

  3. #3
    Member
    Join Date
    May 2001
    Location
    New York, NY, USA
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    David,

    Are you looking to parse the XML source or are you trying to import the contents into an object structure so that you can query the nodes? An example of the page would be helpful.

    -Zareh

    ------------------
    Amelior Technology
    zarehk@ameliortech.com

  4. #4
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    Basic, but it should work. I'll just need to find the right line to pass it.

    Thanks,


    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

  5. #5
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by zarehk:
    Are you looking to parse the XML source or are you trying to import the contents into an object structure so that you can query the nodes? An example of the page would be helpful.
    [/B]<HR></BLOCKQUOTE>

    I am looking for something that can parse out the value of any of the XML nodes. Here is a basic example:

    I am looking for something that could give me the value of note.heading (for instance) back.

    This is a simple XML example, but the use is the same. In the XML I am testing, there might be 50 nodes I need to get the value for and compare agaist a database. Getting the node values 1 at a time is preferred.


    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

    [This message has been edited by davidgenrich (edited 09-26-2001).]

    [This message has been edited by davidgenrich (edited 09-26-2001).]

    [This message has been edited by davidgenrich (edited 09-26-2001).]

  6. #6
    Guest

    Re: Parsing XML with SilkTest

    Assuming that the format of the xml file is similar to what you mentioned earlies following simple parsing function might work, just replace curly braces with angular braces

    [+] list of string GetNoteHeadings(string File)
    [ ] list of string lsFile
    [ ] list of string lsLines
    [ ] list of string lsHead
    [ ] string sLine
    [ ] string sWord
    [ ] ListRead(lsFile,File)
    [ ]
    [-] for each sLine in lsFile
    [-] if Left(sLine,9)=="{heading}"
    [ ] listAppend(lsLines,sLine)
    [-] for each sWord in lsLines
    [ ] string one
    [ ]
    [ ] listAppend(lsHead,StrTran((StrTran(sWord,"{heading }","")),"{/heading}",""))
    [ ] return lsHead


    [This message has been edited by jbarlinge (edited 09-26-2001).]

    [This message has been edited by jbarlinge (edited 09-26-2001).]

  7. #7
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    Actually the XML file is much more complex. There are several nodes with the same name, but the path to them is diffrent.

    Thus, the parser needs to actually know how to parse an XML document.

    Here is a more complex example:

    The value for requestingDocumentDateTime.DateTimeStamp is NULL, but the value for thisDocumentGenerationDateTime.DateTimeStamp is 20011227T183452.540Z.

    Doing a basic document parsing for DateTimeStamp would not give the proper information back.

    I have thought about using the MSXML parser dll, but that requires objects to be made from it. SilkTest, as far as I know, can only access API's directly, rather than creating new objects from them.

    I have thought of using Visual Basic to create a DLL which uses the MSXML parser. This would allow an interface to be exposed to SilkTest that it could handle. However, I can't find my copy of Visual Basic 6.0 anymore Also, I was hoping that someone else had come up with a solution (I know, I'm being lazy).

    However, the suggestions are good and I do appricate them. They just aren't going to work for what I need to do


    ------------------
    David Genrich
    david@e2Open.com
    david_kim@usa.net

  8. #8
    Senior Member
    Join Date
    Apr 2000
    Posts
    401
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    You can do this in Rational Robot by using the GetObject to create an instance of the XML dll (version 3 msxml) then send it the name of the file, html page, xml doc whatever as a string and use the functions to transverse the node tree but it does not work well with objects that are collections (Like combobox type objects ones with data) but Why have I said that I thought in the latest SilkTest you could create your own classes based on other classes? I have not used Silk for a while so forgive me if I have got it wrong but the dll that you speak about can create objects. And I'm sure the new version could use VB, C++ and Java to extend itself! I have not got 5.5 so I'm not 100% BUt if you can you could try one of two ways
    1) You create your own function in a native language like Java or VB (sorry) that queries XML documents and returns various values that you require and you try to base your own class on this supplying the XML doc (path as a string).
    2) You try and create an instance of the MSXML dll and use the methods it supplies for intregating the document. To see what methods are available you can use Excels VBA editor and look under references for the XML dll, tick it then use the object browser (F2) to look what methods you have available as MS does not always implement everything as suggested by W3C (whatever the councils name is)

    ------------------
    The Test Force is strong in this one

  9. #9
    Senior Member
    Join Date
    Sep 2000
    Location
    Twin Cities, MN, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    I ran into a similar issue when I wanted to create an XML document from a layout contained in an Excel workbook.
    Overall using MSXML in a VB 6.0 program was less cumbersome and more intuitive. This is just my opinion. I suppose with the right functions written in SilkTest, calling those functions from a test case would be just as easy. With the functionality built into VB6, though, finding the second instance of a node to insert a child node and element, for example, was a breeze.
    I know I was outputting XML and you're trying to input it - but I think the process would be similar. Good luck and I hope this helps.

    ------------------

  10. #10
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Parsing XML with SilkTest

    Rayr_UK:

    Exactly. Using an external tool to parse the xml node and then use the result is far better especially using the msxml.dll under silk if it's possible otherwise read it through an output from the external tool.

    Parsing the node is more than a simple switch statement. It requires as david pointed out complex logic, basically writting the correct grammar for xml nodes.

    ------------------

 

 
Page 1 of 4 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:21 AM.

Copyright BetaSoft Inc.