I’m having some issues with Xpath in beta 18, I’m using a variation of davids get node id patch, to get multiple ID’s of multiple nodes, on start up it outputs a spread of 0’s.
As soon as you open the subpatch it suddenly outputs the correct spread, the work around seems to be not close the patch, but thats not tidy!
I’ll try and make an example…
MMM the simple example doesnt seem to have this problem, only the big patch, I’ll keep trying…
cat
hmmmm2 I’ve fixed the issue by attaching a io value to the output of the subpatch, it seems that forces it to work, theres something not right in there, previously I was use a string output of the id’s. Not sure if this will give you anything much to go on, but something isnt quite right in there!
Fixed by onopen and a NOT attached to the parent pin of the patchalias node, so something isnt initialising on startup properly?
LOL
So that doesnt fix it, on restarting the patch again its not working, disconnecting the io value, and it works!
much strangeness!
hard to simulate. when i connect a node in the mainpatch to the output of the buggy subpatch, everything works.
if xpath sends its result via the send node then its not working…but only in my big project. in a single patch the query is always right. can’t be bothered anymore. evil bug.
Right this one demos it I think! OR it does here!
Its a version of the girlpower web interface patch, I need it to save itself when changed, so was trying xpath to get the file name, on loading it returns xml version not file name, on attaching to a string io it works…
Thanks Gregsn!
Heres a anomily, that I don’t know if its bug or not, if you have a & in your XML its seems to break xpath, it broke even the queries for differnet paths, just having it in any path stopped any xpaths returning strings. Is this normal behaviour, ie don’t use & as its a special character, or is this a bug?
Took me ages to work out why my xpath suddenly broke!
Attached is a quick demo…
i think & is an “escape character” or something like that. so i think it has a special meaning an needs to be treated in a special way. however i’m by far no xml expert…
in the patch you see 2 possibilities to get around the problem.
either you substitute & by &, which just stands for the character itself. that way it can be embedded anywhere in your xml file.
or you specify a region which never should be parsed by the xpath node and just be treated as normal text. that’s probably the best way to go, because you won’t run in any problems with other vorbidden character sequences…
there might be a possiblity to use an external dtd file, which says that a certain tag will always be plain character data / normal text, so that you don’t need to explicitly write that down in each tag of your xml file… if somebody knows a good page explaining that topic please post here…
I thought it was probably a special case, took some lateral thinking to work out why my patch broke though! I’ve got round it with substitute and I’ll make sure I dont use & in future!
Thanks!