Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Well-formedness check fails with double occurrences of xml:ids #425

Closed
tomschr opened this issue Oct 24, 2017 · 1 comment
Closed

Well-formedness check fails with double occurrences of xml:ids #425

tomschr opened this issue Oct 24, 2017 · 1 comment

Comments

@tomschr
Copy link
Collaborator

tomschr commented Oct 24, 2017

Problem description

Before daps does validation, it checks XML files for syntax errors. This is done by the xmllint command.

However, xmllint conforms also to the xml:id specification which forbids non-unique IDs in XML documents (see below). In this context, xmllint conforms to this spec (which is correct). Unfortunately, it does not contain an option to switch off this behaviour.

This behaviour is needed to create just a syntax check (well-formedness check) which ignores multiple IDs with the same value. However, multiple IDs should be allowed to create the same structure element, but with different content (let's say, a procedure for openSUSE and for SLES both with the same ID, but with different steps). The 2nd step of daps will profile these files to one or the other variant.

Expected behavior

Perform a well-formedness check without taking into account about double or non-unique IDs.

Steps to reproduce the behavior

Create a XML document with the same ID twice.

References

The xml:id specification states:

This mechanism consists of declaring the type of an attribute as "ID", after which the parser will validate that

  • the ID value matches the allowed lexical form,
  • the value is unique within the XML document, and that
  • each element has at most one single unique identifier
@tomschr tomschr self-assigned this Oct 24, 2017
tomschr added a commit that referenced this issue Oct 24, 2017
Script daps-xmlwellformed ignores non-unique IDs in XML files
@fsundermeyer fsundermeyer self-assigned this Oct 24, 2017
@ghost ghost changed the title Well-formedness check fails with double occurances of xml:ids Well-formedness check fails with double occurences of xml:ids Oct 24, 2017
@tomschr
Copy link
Collaborator Author

tomschr commented Oct 24, 2017

I've tested it with the current SLE documentation (MAIN.SLEDS.xml).

Making a syntax error in the MAIN file, the script responds with:

$ daps-xmlwellformed --xinclude xml/MAIN.SLEDS.xml
ERROR: expected '>', line 72, column 5 (MAIN.SLEDS.xml, line 72)
       xml/MAIN.SLEDS.xml:72:5:FATAL:PARSER:ERR_GT_REQUIRED: expected '>'

Makeing a syntax error in one of the xincluded files, the script responds with:

$ daps-xmlwellformed --xinclude xml/MAIN.SLEDS.xml
ERROR: error parsing attribute name, line 19, column 2
       xml/book_sle_admin.xml:19:2:FATAL:PARSER:ERR_NAME_REQUIRED: error parsing attribute name
       xml/book_sle_admin.xml:19:2:FATAL:PARSER:ERR_SPACE_REQUIRED: attributes construct error
       xml/book_sle_admin.xml:19:2:FATAL:PARSER:ERR_GT_REQUIRED: Couldn't find end of Start Tag book line 15
       xml/book_sle_admin.xml:19:2:FATAL:PARSER:ERR_DOCUMENT_END: Extra content at the end of the document
       xml/MAIN.SLEDS.xml:79:0:ERROR:XINCLUDE:XINCLUDE_NO_FALLBACK: could not load xml/book_sle_admin.xml, and no fallback was found

Both error messages are correct.

fsundermeyer pushed a commit that referenced this issue Jul 11, 2018
Closes issue #425

Before DAPS starts any operation, it performs a check for well-formdness. This used to be done with xmllint, which did not allow e.g.

    <section os="foo" xml:id="bar">
    <section os="foo2" xml:id="bar">

and errored because of duplicated IDs. This commit introduces daps-xmlwellformed, which ignores duplicated IDs when checking for well-formdness.
@ghost ghost changed the title Well-formedness check fails with double occurences of xml:ids Well-formedness check fails with double occurrences of xml:ids Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants