¿Cómo funciona la canonicalización de w3c para subconjuntos de documentos?

I am unsure if "xmllint --c14n" works correctly regarding namespaces. For the following input, my hand-made legacy implementation of W3C Canonicalization pulls down the namespace decl xmlns:xsi to the Dcoument-Tag.

<?xml version="1.0" encoding="UTF-8"?>
<conxml xmlns="urn:conxml:xsd:container.nnn.002" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:conxml:xsd:container.nnn.002 container.nnn.002.xsd">
  <MsgPain001>
    <Document xmlns="urn:swift:xsd:$pain.001.002.02">
      <pain.001.001.02>
      </pain.001.001.02>
    </Document>
  </MsgPain001>
</conxml>

Actual result according to my legacy implementation:

...
    <Document xmlns="urn:swift:xsd:$pain.001.002.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...

But xmllint --c14n does not do this, it reports

...
    <Document xmlns="urn:swift:xsd:$pain.001.002.02">
...

Can someone explain who is right according to the spec and why?

ver para más detalles: http://www.w3.org/TR/2001/REC-xml-c14n-20010315#Example-DocSubsets

preguntado el 09 de marzo de 12 a las 14:03

do you have any outstanding questions? Please comment on my answer if you do. Please click the bounty point icon to award the points to me if you are satisfied. If you don't award the points I will not get them but you will be charged anyway for posting the question. See stackoverflow.com/faq#bounty -

Sorry, I have not been online for a while. Yes, your comment was very helpful, but I still have no confirmation on our side. -

Can I still reward the bounty to you? -

The bounty got awarded, thank you. What kind of confirmation are you looking for? The "w3.org/2001/XMLSchema-instance" is unnecessary because the schemaLocation attribute is not included in the document subset. -

You question (title) refers to document subsets. When you use 'document subsets', you might need Exclusive c14n. Just a remark.. -

1 Respuestas

According to the spec (Section 4.6):

Unnecessary namespace declarations are not made in the canonical form.

The "http://www.w3.org/2001/XMLSchema-instance" namespace is not necessary to represent the document subset because the xsi:schemaLocation attribute is not included and the namespace is therefore "unnecessary".

respondido 15 mar '12, 08:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.