Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Watir: XML Element includes Escape Sequences

Reply
Thread Tools

Watir: XML Element includes Escape Sequences

 
 
Lisa Cook
Guest
Posts: n/a
 
      01-17-2008
I'm working on a test script using Watir. I'm new to Ruby and I'm
struggling with syntax.

if (ARGV[0] == nil)
#caseName = 'Default'
caseName = 'Other'
else
caseName = ARGV[0]
end

root = doc.root
testCasePath = "*TestCases/TestCase[@name='" + caseName + "']"

REXML::XPath.each(doc.root, testCasePath) do |elt|
if (elt.attributes["name"] == caseName)
FirstName =elt.elements["FirstName"].text
puts FirstName


When I get the FirstName value there are a bunch of escape characters
(/n/t/t) coming from the XML document.

Do I have bad syntax or is there another problem?

Thanks.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Lisa Cook
Guest
Posts: n/a
 
      01-17-2008
Never mind. As soon as I posted, I figured it out.

I was using the Visual Studio IDE to create my XML document. I didn't
realize that the IDE added formatting characters. I moved my XML to
notepad and it worked fine.

Hopefully this post will help someone else.

Lisa Cook wrote:
> I'm working on a test script using Watir. I'm new to Ruby and I'm
> struggling with syntax.
>
> if (ARGV[0] == nil)
> #caseName = 'Default'
> caseName = 'Other'
> else
> caseName = ARGV[0]
> end
>
> root = doc.root
> testCasePath = "*TestCases/TestCase[@name='" + caseName + "']"
>
> REXML::XPath.each(doc.root, testCasePath) do |elt|
> if (elt.attributes["name"] == caseName)
> FirstName =elt.elements["FirstName"].text
> puts FirstName
>
>
> When I get the FirstName value there are a bunch of escape characters
> (/n/t/t) coming from the XML document.
>
> Do I have bad syntax or is there another problem?
>
> Thanks.


--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read strings cantaining escape character from a file and useit as escape sequences? slomo Python 5 12-02-2007 11:39 AM
vhdl textio and escape sequences Olaf Petzold VHDL 1 11-28-2005 06:22 PM
processing escape sequences exactly like compiler does Harald Kirsch Java 0 11-19-2004 11:34 AM
Modifying escape sequences in strings Thomas Philips Python 2 03-02-2004 04:40 PM
Escape sequences and printing Kit C Programming 5 09-17-2003 02:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57