Re: [xml] redicting parts of trees



Kasimier Buchcik wrote:

Simple, but not intended. Additionally not correct, since the axis from
the anchor element to the referenced node must not shadow the added
ns-prefix.

With raising an error is this case, adoption wouldn't work on
attribute- and fragment-nodes. Maybe for fragment-nodes we could
anchor the ns-decls on the fragment-node itself.

However, we could add an option to let it work as you describe; although
I don't see the point in writing an adopt function that does not support
single attribute nodes.
Maybe Rob Richards and Martijn Faassen could give some feedback about
the way we should go here - after all I see it as a "help-the-wrapper"
function.
To make sure I am following this correctly as these messages are getting damn long: The problem is what to do if node is not an element and no parent is passed in, correct?

For an element, xmlReconciliateNs can be used after its set to the new document.

For attributes, wouldn't these be considered as being in document scope? So the namespace could be declared on the document element and things reconciled if/when it gets appended to an element. If the document doesnt have a document element then issue error.

For fragments, the process should be done the same way. The namespace CANT be declared on the fragment node.

Yeah might be good, although I'd like to have an optimised version at
the end. We should consider not only splitting the code, but to
fork to different handlers: one if @node is an element or
fragment, one if it's an attribute, and a third otherwise. We need
that complexity only for a branch of element nodes.
I agree about breaking it up too, though not sure what you mean about forking. It is only going to get more complex as it still needs to handle the entity refs, IDs, etc..

Rob





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]