On Wed, February 21, 2007 11:44 pm, Eli wrote: > Peter Lauri wrote: >> This was not clear for me, do you mean: >> >> <a peter> => <a id="peter"> >> > > No. > > Let me try to be more clear.. > Say you got the element <elem key="peter"> , then I want the > DOMDocument > to automatically convert the 'key' attribute to an ID-Attribute, as > done > with DOMElement::setIdAttribute() function. The ID-Attribute is > indexed > and can be quickly gotten via DOMDocument::getElementById() function. > > I'm trying to avoid looping on all nodes overriding the importNode() > and > __construct() methods of DOMDocument. Are the keys guaranteed to be unique? If not, you can't do that, because the IDs have to be unique, no? I suspect you'll simply have to walk the whole thing and do it the hard way, if it's even a Good Idea... You might be better off taking a step back and asking the list how they solved whatever problem you're trying to solve with auto-generating the IDs, as there may be a Better Way... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php