<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Thank you Rainer!</div>
<div> </div>
<div>Sorry for not bugging this response but I have a live deployment in "another window" making me go cross-eyed. The deployment is (of course) via wpkg but (as usual)</div>
<div>half the staff have forgotten to leave things on as requested :-/</div>
<div> </div>
<div>I'll report a response on Saturday. I appear to have whole weekend off whilst the kids go camping! Woo hoo!.</div>
<div> </div>
<div>Once I'd worked out all I'd offered was a stupid response (Doh!), I surfed. It looks like this is not a very unusual thing. I've seen many people's attempts to</div>
<div>construct wrappers to count quotes,  pre-compile requests or pre-encode quotes/apostrophes but the simplest one of all was to not even try! </div>
<div> </div>
<div>If you know your own namespace, you can cheat and add your search terms as attributes with temporary names. Then it becomes a lot easier to just reference them in the</div>
<div>x-path query and let the XML object handle the encoding.</div>
<div> </div>
<div> It's a bit ugly (and I aim to re-write this as something a bit more re-usable) but I'm playing with this at the moment and it looks really rock solid.</div>
<div> </div>
<div> In the getSettingsCheck function…</div>
<div> </div>
<div>                // Check whether attributes are defined.</div>
<div>                if (attributes.length > 0) {</div>
<div>                        var attributesClause = "";</div>
<div>                        var checkMessage = "";</div>
<div>                        for (var iAttribute=0; iAttribute < attributes.length; iAttribute++) {</div>
<div>                                if (attributesClause != "") {</div>
<div>                                        attributesClause += " and ";</div>
<div>                                        checkMessage += ", ";</div>
<div>                                }</div>
<div>                                var node = attributes.item(iAttribute);</div>
<div>                                var attribute = node.nodeName;</div>
<div>                                var value = node.nodeValue.replace(new RegExp("\\\\", "g"), "\\\\");</div>
<div>                                checkResults.setAttribute("WPKGSEARCHPARAM" + iAttribute, value); // Add value as an attribute with a generated name (at root level)</div>
<div>                                attributesClause += "@" + attribute + "=/*/@WPKGSEARCHPARAM" + iAttribute; // Remember to use /*/ to use the root level reference</div>
<div> </div>
<div>//                              attributesClause += "@" + attribute + "=\"" + value + "\"";</div>
<div>                                checkMessage += attribute + "='" + value + "'";</div>
<div>                        }</div>
<div>                        // Get all nodes which match the attributes.</div>
<div>                        dinfo("Searching for previously executed checks with attributes " + checkMessage);</div>
<div>                        var xPathQuery = "check[" + attributesClause + "]";</div>
<div>                        // dinfo("Query to find previously executed check: " + xPathQuery);</div>
<div>                        var checkNodes = checkResults.selectNodes(xPathQuery);</div>
<div> </div>
<div>                        for (var iAttribute=0; iAttribute < attributes.length; iAttribute++) {</div>
<div>                                checkResults.removeAttribute("WPKGSEARCHPARAM " + iAttribute); //Remove the attributes quickly before the checks get saved</div>
<div>                        }</div>
<div> </div>
<div> </div>
<div> It's coping with everything I've throw at it so far <font face="Wingdings">J</font></div>
<div> </div>
<div>I can write a generalised function for this easily enough tomorrow but in the meantime, I'd best get back to the "other" window. Wake-on-LAN here I come <font face="Wingdings">J</font></div>
<div> </div>
<div>Keith</div>
<div> </div>
<div> </div>
<div> </div>
<div>-----Original Message-----</div>
<div>From: wpkg-users-bounces@lists.wpkg.org [<a href="mailto:wpkg-users-bounces@lists.wpkg.org">mailto:wpkg-users-bounces@lists.wpkg.org</a>] On Behalf Of bugzilla-daemon@bugzilla.wpkg.org</div>
<div>Sent: 22 May 2014 17:35</div>
<div>To: wpkg-users@lists.wpkg.org</div>
<div>Subject: [wpkg-users] [Bug 285] wpkg.xml not valid under some circumstances.</div>
<div> </div>
<div><a href="http://bugzilla.wpkg.org/show_bug.cgi?id=285">http://bugzilla.wpkg.org/show_bug.cgi?id=285</a></div>
<div> </div>
<div>Rainer Meier <r.meier@wpkg.org> changed:</div>
<div> </div>
<div>           What    |Removed                     |Added</div>
<div>----------------------------------------------------------------------------</div>
<div>             Status|RESOLVED                    |UNCONFIRMED</div>
<div>         Resolution|INVALID                     |</div>
<div>     Ever Confirmed|1                           |0</div>
<div> </div>
<div>--- Comment #5 from Rainer Meier <r.meier@wpkg.org>  --- I am currently also quite loaded so I didn't have time to investigate further.</div>
<div>As you said I don't want to do a change which actually just moves the problem elsewhere and potentially introduces risk of breaking something else.</div>
<div>So best would be perhaps to have some kind of "prepared statement" for x-path query rather than generating the query string dynamically. Although I don't know (yet) whether this is possible with Microsoft XML framework.</div>
<div> </div>
<div>If you come up with a proposed solution I will certainly review it. I will also do some research and investigation as soon as I have some time to do so.</div>
<div> </div>
<div>--</div>
<div>Configure bugmail: <a href="http://bugzilla.wpkg.org/userprefs.cgi?tab=email">
http://bugzilla.wpkg.org/userprefs.cgi?tab=email</a></div>
<div>------- You are receiving this mail because: ------- You are the QA contact for the bug.</div>
<div>-------------------------------------------------------------------------</div>
<div>Vacation Rentals, Homes, Apartments & Rooms - sign up and get $25 off your first booking!
<a href="http://www.ptraveler.com/redir/airbnb">http://www.ptraveler.com/redir/airbnb</a></div>
<div>-------------------------------------------------------------------------</div>
<div>wpkg-users mailing list archives >> <a href="http://lists.wpkg.org/pipermail/wpkg-users/">
http://lists.wpkg.org/pipermail/wpkg-users/</a></div>
<div>_______________________________________________</div>
<div>wpkg-users mailing list</div>
<div>wpkg-users@lists.wpkg.org</div>
<div><a href="http://lists.wpkg.org/mailman/listinfo/wpkg-users">http://lists.wpkg.org/mailman/listinfo/wpkg-users</a></div>
<div> </div>
<div>___________________________________________________________</div>
<div>This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton.</div>
<div>For more information see <a href="http://www.brighton.ac.uk/is/spam/">http://www.brighton.ac.uk/is/spam/</a></div>
<div>___________________________________________________________</div>
<div> </div>
</span></font>
<br clear="both">
___________________________________________________________<BR>
This email has been scanned by MessageLabs' Email Security<BR>
System on behalf of the University of Brighton.<BR>
For more information see http://www.brighton.ac.uk/is/spam/<BR>
___________________________________________________________<BR>
</body>
</html>