Re: [xml] Id attribute detection in arbitrary namespace

On Sun, Aug 04, 2013 at 09:40:02PM +0400, Алексей Емельянов wrote:

We discovered a problem with Id attribute detection, defined
as a global attribute in some external schema.

Here is an example:



         <ds:Signature xmlns:ds="";>
               <ds:Reference URI="#body"></ds:Reference>
   <soapenv:Body wsu:Id="body"></soapenv:Body>

Attribute "wsu:Id" is not detected as an Id attribute,
because libxml2 knows nothing about its type,
defined in wss-wssecurity-utility-1.0.xsd:

<!-- // Global attributes // -->
<xsd:attribute name="Id" type="xsd:ID">
    This global attribute supports annotating arbitrary
    elements with an ID.

As a result any library, such as xmlsec as an example,
cannot process such documents using "id()"
XPath expression.

Function xmlIsID can use DTD for Id detection,
but DTD does not allow to describe
the global attributes.

Is there known solution for this issue?

Don't bury the knowledge of the IDness in an external schemas:

name your id xml:id, libxml2 will detect automatically , the spec
has been around for 8 years, and libxml2 implements it since then.


Daniel Veillard      | Open Source and Standards, Red Hat
veillard redhat com  | libxml Gnome XML XSLT toolkit | virtualization library

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