I am building a DTD for a tool that will modify only attributes. I do not care if it is DTD compliant. I am looking to have ANY element be able to be a child of any other element. Just to keep the parser from modifying the data set. Currently I have any entity that contains a complete list of elements and allowing ((zero or more) of each) zero or more times.
Asked
Active
Viewed 61 times
1 Answers
0
I think you probably could make all elements an inclusion of root, but yuck.
Example of yuckyness...
<!ELEMENT root - - (all|child|elements)* +(all|child|elements)>

Daniel Haley
- 51,389
- 6
- 69
- 95
-
I'm sorry can you explain inclusion of root to me. Or provide a link, the current DTD does have that but 'child' is coming up as not a valid child of 'elements' – TheBrandonMorris Oct 08 '20 at 18:39
-
@TheBrandonMorris - The inclusion (`+(all|child|elements)`) means that those elements are allowed anywhere inside that element (`root` in this example). This won't work if there are exclusions (similar to inclusions, but start with '-' (like `-(some|elements)`). It also won't work if your SGML is a fragment that doesn't start with the same root element. For example, if the element was `all`, `child` and `elements` would not be allowed unless the model for `all` declares that they can or if there is also an inclusion on `all` (and no exclusions). Hopefully this makes sense. – Daniel Haley Oct 08 '20 at 20:59
-
Yes it does thank you. This is my first SGML task I'm used to XML. Just to clarify when you say anywhere do you mean including within the children or just within the root element its self? – TheBrandonMorris Oct 08 '20 at 21:16
-
@TheBrandonMorris - As a descendant of that element at any level (unless it's excluded by an exclusion). – Daniel Haley Oct 08 '20 at 21:56