Cannot bind to xmlns attribute content

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot bind to xmlns attribute content

FraserHore-2
I have an xform to edit xforms and i wanted to be able to edit the
xmlns attributes in the xform being edited.  Unfortunately it seems
that these attributes are not accessible through xpath expressions
like:

/xhtml:html/@xmlns

Does anyone know why this is?

Thanks,

Fraser

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: Cannot bind to xmlns attribute content

Clark, John
Fraser,

> I have an xform to edit xforms and i wanted to be able to edit the
> xmlns attributes in the xform being edited.  Unfortunately it seems
> that these attributes are not accessible through xpath expressions
> like:
>
> /xhtml:html/@xmlns
>
> Does anyone know why this is?

The short answer is that you cannot access namespace declaration attributes using the XPath attribute axis.

Here's the long answer.  XPath provides a model for accessing content based on both XML and XML Namespaces.  In order to do this, the namespace declarations are not treated as regular attributes; instead, they reflect the current state of the namespace prefix bindings that exist for a particular element and for that element's descendants.  As a result, the only way to affect the set of namespace prefix declarations on an element using a technology built on XPath is to change the names of elements or attributes in the document.  (Note that even then, a conforming serializer could still modify the prefixes as long as it does so consistently.)

Take care,

    John L. Clark

===================================

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use
only by the individual or entity to which it is addressed
and may contain information that is privileged,
confidential, and exempt from disclosure under applicable
law.  If the reader of this message is not the intended
recipient or the employee or agent responsible for
delivering the message to the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.  If
you have received this communication in error,  please
contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy.  Thank you.


_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Cannot bind to xmlns attribute content

FraserHore-2
In reply to this post by FraserHore-2
On Sep 17, 8:48 am, "Clark, John" <[hidden email]> wrote:

> Fraser,
>
> > I have an xform to edit xforms and i wanted to be able to edit the
> > xmlns attributes in the xform being edited.  Unfortunately it seems
> > that these attributes are not accessible through xpath expressions
> > like:
>
> > /xhtml:html/@xmlns
>
> > Does anyone know why this is?
>
> The short answer is that you cannot access namespace declaration attributes using the XPath attribute axis.
>
> Here's the long answer.  XPath provides a model for accessing content based on both XML and XML Namespaces.  In order to do this, the namespace declarations are not treated as regular attributes; instead, they reflect the current state of the namespace prefix bindings that exist for a particular element and for that element's descendants.  As a result, the only way to affect the set of namespace prefix declarations on an element using a technology built on XPath is to change the names of elements or attributes in the document.  (Note that even then, a conforming serializer could still modify the prefixes as long as it does so consistently.)
>
> Take care,
>
>     John L. Clark
>
> ===================================
>
> Cleveland Clinic is ranked one of the top hospitals
> in America by U.S. News & World Report (2007).
> Visit us online athttp://www.clevelandclinic.orgfor
> a complete listing of our services, staff and
> locations.
>
> Confidentiality Note:  This message is intended for use
> only by the individual or entity to which it is addressed
> and may contain information that is privileged,
> confidential, and exempt from disclosure under applicable
> law.  If the reader of this message is not the intended
> recipient or the employee or agent responsible for
> delivering the message to the intended recipient, you are
> hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited.  If
> you have received this communication in error,  please
> contact the sender immediately and destroy the material in
> its entirety, whether electronic or hard copy.  Thank you.

That's interesting.  Thanks John!

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms