Thank you Rainer! 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) half the staff have forgotten to leave things on as requested :-/ I'll report a response on Saturday. I appear to have whole weekend off whilst the kids go camping! Woo hoo!. 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 construct wrappers to count quotes, pre-compile requests or pre-encode quotes/apostrophes but the simplest one of all was to not even try! 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 x-path query and let the XML object handle the encoding. 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. In the getSettingsCheck function... // Check whether attributes are defined. if (attributes.length > 0) { var attributesClause = ""; var checkMessage = ""; for (var iAttribute=0; iAttribute < attributes.length; iAttribute++) { if (attributesClause != "") { attributesClause += " and "; checkMessage += ", "; } var node = attributes.item(iAttribute); var attribute = node.nodeName; var value = node.nodeValue.replace(new RegExp("\\\\", "g"), "\\\\"); checkResults.setAttribute("WPKGSEARCHPARAM" + iAttribute, value); // Add value as an attribute with a generated name (at root level) attributesClause += "@" + attribute + "=/*/@WPKGSEARCHPARAM" + iAttribute; // Remember to use /*/ to use the root level reference // attributesClause += "@" + attribute + "=\"" + value + "\""; checkMessage += attribute + "='" + value + "'"; } // Get all nodes which match the attributes. dinfo("Searching for previously executed checks with attributes " + checkMessage); var xPathQuery = "check[" + attributesClause + "]"; // dinfo("Query to find previously executed check: " + xPathQuery); var checkNodes = checkResults.selectNodes(xPathQuery); for (var iAttribute=0; iAttribute < attributes.length; iAttribute++) { checkResults.removeAttribute("WPKGSEARCHPARAM " + iAttribute); //Remove the attributes quickly before the checks get saved } It's coping with everything I've throw at it so far :) 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 :) Keith -----Original Message----- From: wpkg-users-bounces at lists.wpkg.org [mailto:wpkg-users-bounces at lists.wpkg.org] On Behalf Of bugzilla-daemon at bugzilla.wpkg.org Sent: 22 May 2014 17:35 To: wpkg-users at lists.wpkg.org Subject: [wpkg-users] [Bug 285] wpkg.xml not valid under some circumstances. http://bugzilla.wpkg.org/show_bug.cgi?id=285 Rainer Meier <r.meier at wpkg.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID | Ever Confirmed|1 |0 --- Comment #5 from Rainer Meier <r.meier at wpkg.org> --- I am currently also quite loaded so I didn't have time to investigate further. 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. 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. 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. -- Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. ------------------------------------------------------------------------- Vacation Rentals, Homes, Apartments & Rooms - sign up and get $25 off your first booking! http://www.ptraveler.com/redir/airbnb ------------------------------------------------------------------------- wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/ _______________________________________________ wpkg-users mailing list wpkg-users at lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/wpkg-users ___________________________________________________________ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___________________________________________________________ ___________________________________________________________ This email has been scanned by MessageLabs' Email Security System on behalf of the University of Brighton. For more information see http://www.brighton.ac.uk/is/spam/ ___________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20140523/a9ecc6c5/attachment.html> |