This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

DOCTYPE definition

 
Greenhorn
Posts: 15
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm a beginner with XML and need some basic help.

This is the general external reference to a DTD.

<!DOCTYPE root-element SYSTEM "filename">

And this is a specific example.

<!DOCTYPE note SYSTEM "Note.dtd">

Where should the Note.dtd file be placed, so that the xml document is validated against this dtd?

Thanks,
Karthick
 
Sheriff
Posts: 26950
83
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The parser will treat "Note.dtd" as a path that is relative to the base URL of the XML document it is parsing.

So, usually this means you put the DTD in the same directory as the XML document. If the base URL is an http:// URL then you have to make sure the server will serve the DTD from the appropriate path.

And you have to make sure the parser actually has a base URL for the XML document. If you pass it an InputStream, for example, then it doesn't have one and thus it won't be able to find the DTD.

If you provide the parser with an EntityResolver which locates the DTD itself, then you can put the DTD anywhere you like, as long as the EntityResolver knows where you put it.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic