You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Andy Clark <an...@apache.org> on 2002/03/01 09:29:21 UTC

Re: Validation with a DTD

Alan McGuinness wrote:
> I'm new to this XML thing, so I'm playing with Xerces. I'm just wondering
> how do I specify what DTD file that I want to use to validate my XML string
> when using a DOM parser?

Your document must have a DOCTYPE line. For example:

  <!DOCTYPE root SYSTEM 'grammar.dtd'>
  <root/>

Check the XML 1.0 (second edition) spec located at w3.org
for exact details.

Later, when Xerces2 has a proper grammar caching mechanism,
it should be possible to validate a document using a pre-loaded
DTD grammar regardless of whether the document contained an
explicit DOCTYPE line.

> I realise this is a newbie question, but humour me! :)

A couple of cannibals are eating a clown. One cannibal turns
to the other and asks, "Does this taste funny to you?"

-- 
Andy Clark * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org