0

Given:

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, ((diagnostic-track-automated, diagnostic-track-manual) | diagnostic-track-automated | diagnostic-track-manual), evaluate*, disconnect*)>

and

<!ELEMENT diagnostic-track-automated (((%step;) | diagnostic_group)*, diagnostic_group, evaluate*)>

<!ENTITY % step "((%figtab;) | step1 | step1-alt)">
<!ENTITY % figtab "figure | figure-alt | table | table-alt | lubetab">

I am getting non-deterministic content model errors that diagnostic-track-automated and diagnostic_group could simultaneously match two or more tokens.

I changed to:

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, diagnostic-track-automated?, diagnostic-track-manual?, evaluate*, disconnect*)>

and

<!ELEMENT diagnostic-track-automated (((%step;) | diagnostic_group+)*, evaluate*)>

which eliminated the error messages, but I don't think my changes, especially for diagnostic-track-automated, are correct.

I appreciate any suggestions for improvement.

Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
Caroline
  • 167
  • 1
  • 11

1 Answers1

1

I think what you came up with for diagnostic-tracks appears to be what you were trying to accomplish with the original non-deterministic model:

zero or more hookup elements followed by
zero or more elements from %step; followed by
zero or one diagnostic-track-automated element followed by
zero or one diagnostic-track-manual element followed by
zero or more disconnect elements

However I think the fix for diagnostic-track-automated is not what you originally intended.

What you propose now is:

zero or more elements from %step; or diagnostic_group followed by
zero or more evaluate elements

What I think you meant was:

zero or more elements from %step; followed by
one or more diagnostic_group elements followed by
zero or more evaluate elements

Which would be:

<!ELEMENT diagnostic-track-automated ((%step;)*, diagnostic_group+, evaluate*)>

Here's a full/testable example...

DTD (so.dtd)

<!ENTITY % figtab "figure | figure-alt | table | table-alt | lubetab">
<!ENTITY % step "%figtab; | step1 | step1-alt">

<!ELEMENT diagnostic-tracks (hookup*, (%step;)*, diagnostic-track-automated?, diagnostic-track-manual?, evaluate*, disconnect*)>

<!ELEMENT diagnostic-track-automated ((%step;)*, diagnostic_group+, evaluate*)>

<!ELEMENT table EMPTY>
<!ELEMENT table-alt EMPTY>
<!ELEMENT diagnostic_group EMPTY>
<!ELEMENT step1-alt EMPTY>
<!ELEMENT evaluate EMPTY>
<!ELEMENT figure EMPTY>
<!ELEMENT figure-alt EMPTY>
<!ELEMENT lubetab EMPTY>
<!ELEMENT step1 EMPTY>
<!ELEMENT diagnostic-track-manual EMPTY>
<!ELEMENT disconnect EMPTY>
<!ELEMENT hookup EMPTY>

XML

<!DOCTYPE diagnostic-tracks SYSTEM "so.dtd">
<diagnostic-tracks>
    <diagnostic-track-automated>
        <diagnostic_group/>
    </diagnostic-track-automated>
    <diagnostic-track-manual/>
</diagnostic-tracks>
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
  • Thanks, Daniel this eliminated the errors. However, I thought `((%step;) | diagnostic_group+)*` meant `&step;` could follow `` – Caroline Feb 28 '20 at 22:11
  • @Caroline - Yes that's true and that's what I was trying to say with "_zero or more elements from %step; or diagnostic_group followed by_". So it's basically: `(figure|figure-alt|table|table-alt|lubetab|step1|step1-alt|diagnostic_group)*` (the `+` occurrence indicator on `diagnostic_group` doesn't mean anything because it's in that zero or more "or" group). Sorry that wasn't more clear. Hopefully my comment makes sense. – Daniel Haley Feb 28 '20 at 22:16
  • you were clear, I wasn't. I meant I thought `((%step;) | diagnostic_group+)*` would allow `%step;%step; ` but `((%step;)*, diagnostic_group+` would not permit a `%step;` after `` – Caroline Feb 28 '20 at 22:43
  • @Caroline - Yes, what you're saying is correct. Do you need to be able to have `%step;` after `diagnostic_group`? – Daniel Haley Feb 28 '20 at 22:53
  • yes, thanks. This is actually from the MIL STD 40051C v6.3 dtd. – Caroline Feb 28 '20 at 23:25
  • @Caroline - What I would do is add a `, (%step;)*` after `diagnostic_group+` like so: `<!ELEMENT diagnostic-track-automated ((%step;)*, diagnostic_group+, (%step;)*, evaluate*)>` – Daniel Haley Feb 28 '20 at 23:50