1 message in com.canoo.lists.webtest[Webtest] Another hint for factoring ...| From | Sent On | Attachments |
|---|---|---|
| Alan Grover | 04 Apr 2003 06:43 |
| Subject: | [Webtest] Another hint for factoring your ANT xml file![]() |
|---|---|
| From: | Alan Grover (awgr...@mail.msen.com) |
| Date: | 04/04/2003 06:43:04 AM |
| List: | com.canoo.lists.webtest |
Here's my first quick solution to creating entities that contain double-quotes (or, conversely, single-quotes).
The canoo webtest website recommends lifting small repeated chunks of XML into entities: <config value="some"> ...</config> to <?xml version="1.0"?> <!DOCTYPE project [ <!ENTITY config "<config value='some'> ...</config>"> ]> ... <task blah>&config;</task> noting the translation of " to '.
But what about the case where you have a ' in the attribute value? For example, an xpath expression: string(//div[@id='statTable']) you'd want something like: <verifyxpath text="90" regex="true" stepid="check for value" xpath="string(//div[@id='statTable'])" /> Note the ' in the double-quoted xpath attribute value.
I tried using entities to encode the double quotes (instead of translating them to single quotes). This works as long as you use the numeric encoding and not the entity _name_ (since it doesn't exist!): <?xml version="1.0"?> <!DOCTYPE project [ <!ENTITY checkStatTable " <verifyxpath text='already in use' regex='true' stepid='check already in-use validation' xpath="string(//div[@id='statTable'])" />"
(I didn't have any CR in my real file, in the entity definition above). Notice the , which is ".
I put larger chunks in a file and "include" it with the SYSTEM entity declaration.
What other solutions have you discovered? --- Alan Grover awgr...@mail.msen.com




