Archive for the ‘XML’ Category

DBXMLAdmin updates

Thursday, May 29th, 2008

After being completely annoyed by SimpleXML earlier I decided it was time to look at DBXML again. This time I ran across a forum posting saying that DBXML 2.4.11 had a bug in it preventing updating. After upgrading to 2.4.13 I was able to update documents in a container. So I made some update to the project but realized that this was more of an out of control experiment than a real project. Already started redoing it, all the PHP is going to be new but I have managed to reuse most of the Javascript.

I also found this site DBXML With PHP, it is a small wiki for, as the name says, using DBXML with PHP. It has not been updated in a while (until today) but I will keep adding things as I progress on DBXML. Hopefully other will help out too, right now there are few resources for DBXML in PHP.

jQuery multiSubSelector

Sunday, May 11th, 2008

I am doing some work today on the DBXML Admin adding editable tag names, attributes and values like in Firebug. The way the HTML was laid out, the attributes each had a tag around them for styling. I was working on returning the LI/SPAN representation of the XML as an XML string for updating the server. The problem I was running into was in the way the selector was ordering the elements to be returned. The right way. What I wanted was different.

$('li:eq(1)').find('span.tagName,span.tagAttr,span.tagAttrValue,span.tagValue');

This worked fine if the node only had one or no attributes. But if there was more than one, it would group attribute names together and then group their values together. I know this could be solved with a bit of mapping or checking the tags while eaching, but making a new selector sounded funner.
So this is what I came up with. First I changed around the attribute tags. The span.tagAttr was a wrapper for the new span.tagAttrName and the original span.tagAttrValue. And the new subselector allow grabbing multiple descendant rather then just one ($(‘ascendant descendant‘))

$('li:eq(1)'.find('span.tagName,span.tagAttr(span.tagAttrName,span.tagAttrValue),span.tagValue');

Simple as that and I have everything in the order it was supposed to be. I know this could be accomplished several different way. It was more of an exercise in selectors, but in the end I think it addition to the selector engine.
Here is a link to the patch for the current SVN.