[dmarc-discuss] Using XMLLINT to uncover errors with feedback & XSD files

Brian Corrigan bcorrigan at majorleaguegaming.com
Thu Jun 14 22:04:32 PDT 2012


Hey Trent & Team -

I'm finding a few more errors as I work with the XSD file itself as
well as the feedback files being sent over.  I'm uncovering these
errors using XMLLINT.

My test is:

xmllint --noout --schema rua.xsd ../doc/report_sample_yahoo.xml

I'm working through each error as it comes up.  The ones I've found
are listed below:

** XSD File Namespace
The root element needs to define file the default namespace or else
the XSD parser can't reference the file itself for custom defined
types.  Since its also defining a namespace, it needs to be equal to
the target namespace.

This fixes it:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://dmarc.org/dmarc-xml/0.1"
  xmlns="http://dmarc.org/dmarc-xml/0.1">

** Feedback File Namespace
None of the reports I'm seeing are defining a namespace so one can't
apply the XSD file.  There's two options, first we could define a root
element and reference the namespace there (probably not a good idea).
As an example:

<root xmlns="http://dmarc.org/dmarc-xml/0.1">
<feedback></feedback>
</root>

The other option is to require the namespace attribute be defined on
the feedback attribute.  I prefer this approach.

<provider:feedback xmlns:provider="http://dmarc.org/dmarc-xml/0.1">
</provider:feedback>

** XSD File Regex
The regex isn't working because it spans multiple lines (Happens to me
all the time when I forget to turn off auto-fill mode in emacs!).  It
needs to be:

<xs:pattern value="((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]).){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])|([A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}"/>

** Namespace (Not technically broken)

Finally, the namespace itself.  It would be cleaner if we could
declare it as something like "urn:dmarc" instead of
"http://dmarc.org/dmarc-xml/0.1".  .  If so, we'd have:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="urn:dmarc"
  xmlns="urn:dmarc">
...
<provider:feedback xmlns="urn:dmarc">	

Etc.



I realize the ship may have sailed at this point, but I wanted to at
least get a thread going with issues.

Thanks guys!
B


More information about the dmarc-discuss mailing list