When should a DTD be made public
When creating a custom external DTD you have the choice of making it private or public. When should a DTD be made public?
In this case I'm creating a DTD for an xml file which will describe product. The XML will be created by our client, filled with data from their old system. we will import this data into the new system we are building for them.Does this exchange between different companies require a public DTD? What are the benifit开发者_运维百科s or drawbacks?
I think that you have a number of misunderstandings here.
Are you using the word 'public' to refer to a PUBLIC identifier in the DOCTYPE, or are you using it informally to mean, 'available'?
Putting a PUBLIC ID into a DOCTYPE means that no program or person will be able to find the actual DTD contents without a catalog. Putting a SYSTEM ID into a DOCTYPE, if that ID is a URL, means that people and programs can find it.
If it is important for you that validating parsers find and use the DTD, then you either have to combine PUBLIC with catalog usage or stick with SYSTEM and a URL.
These days, W3C XML Schema is more commonly used for this purpose than DTD.
精彩评论