Question:
I am having problems designing my XML doc. I’d like togeneralize it using common structure names but it appears that the DTD/Schemafor it can’t fully describe it. Here is my XML doc without the outer tags:
I don’t think it’s possible for a DTD and Schema to require that only element “b” isallowed in “inner id=b” under “outer id=2”. The DTD or Schema will just statethat “a”, “b”, and “c” are allowed under any “inner” element. If my assumption is correct, then should I just redesign my XML to havespecific names like “outer1” and “outer2” as opposed to being general?
Answer:
In this situation, you really are better off creating two distinct tags,
This object-oriented view toward designing your XML works effectively in a wide number of circumstances. It is part of the reason that the “canonical” XML structure emphasizes unique “property-like” tagnames, rather than more generic tag descriptors. XML is likely to be a critical part of the post-OOP world partly because it encapsulates many of the principles of OOP programming without the machine dependencies that have plagued more programmatic implementations of those same principles.