Karel Michek wrote:
> Thank you for the advice. The performance is great. The only problem
> is that the DOM tree needs to build in the memory and xml:id does not
> seem work to work in this case (so to make the test work the XML
> document was serialized and parsed back).
>
> The following fragments from different e-mails can be relevant to this
> problem:
>
> >> DOMDocument::getElementByID() doesn't work with xml:id
> >> if the DOMDocument is being created in code.
>
> > And will never work that way. IDs would need to be set
> > using the DOMElement setIdAttribute methods, but these
> > aren't currently implemented as there are some libxml
> > issues surrounding this.
>
> and
>
> > setIDAttribute - thats on the TODO list. Were some previous libxml
> > issues to be resolved before that could be implemented (so it will be
> > added).
>
Those messages are really old :)
> So I wander if it is currently possible to build DOMDocument in the
> code and and make
> IDs work (or will that be possible)?
>
Yes, this is now possible. You will need at least .21 (This is the
version a lot of the IDness changes were made in).
You will need to use the method DOMElement::setAttribute('xml:id', <id>)
As far as the setID... methods, these are implemented in the latest PHP
5.2.0 release.
Rob
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml