Re: [xml] Id attribute detection in arbitrary namespace
- From: Daniel Veillard <veillard redhat com>
- To: Алексей Емельянов <emal lim ru>
- Cc: xml gnome org
- Subject: Re: [xml] Id attribute detection in arbitrary namespace
- Date: Mon, 5 Aug 2013 10:56:39 +0800
On Sun, Aug 04, 2013 at 09:40:02PM +0400, Алексей Емельянов wrote:
Hello.
We discovered a problem with Id attribute detection, defined
as a global attribute in some external schema.
Here is an example:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soapenv:Header>
<wsse:Security>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:Reference URI="#body"></ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue/>
<ds:KeyInfo>
<ds:KeyName/>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
</soapenv:Header>
<soapenv:Body wsu:Id="body"></soapenv:Body>
</soapenv:Envelope>
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">
<xsd:annotation><xsd:documentation>
This global attribute supports annotating arbitrary
elements with an ID.
</xsd:documentation></xsd:annotation>
</xsd:attribute>
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:
http://www.w3.org/TR/xml-id/
name your id xml:id, libxml2 will detect automatically , the spec
has been around for 8 years, and libxml2 implements it since then.
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]