[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: DTD validation without a DOCTYPE


samuel caro
At 2002-02-05 20:23 -0600, Caro, Samuel wrote:
>Is there a way to validate against a DTD if the xml file does NOT have a
>DOCTYPE?

Yes, there is a way of doing this entirely within XML 1.0 Recommendation 
without resorting to any proprietary functionality.

When I have to do this without munging the actual files themselves, I use 
parameter and general entities to effect the result.

I hope the example below helps.  Note how I can visually confirm the parts 
of the document by aligning the names of the document element type, DTD 
file, and the instance file.

Just create one of these XML instances for each combination of the three.

.................... Ken

T:\ftemp>type foo.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<foo>
   <bar/>
</foo>
T:\ftemp>type foo.dtd
<!ELEMENT foo ( bar )>
<!ELEMENT bar EMPTY>

T:\ftemp>type caro.xml
<!DOCTYPE  dummy-document-element [
<!ELEMENT  dummy-document-element      ( foo )>
<!ENTITY % dummy-document-dtd    SYSTEM "foo.dtd">
<!ENTITY   dummy-document-entity SYSTEM "foo.xml">
%dummy-document-dtd;
]>
<dummy-document-element>&dummy-document-entity;</dummy-document-element>

T:\ftemp>xml caro.xml
Processing: 'caro.xml' for XML errors

T:\ftemp>


--
Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002

G. Ken Holman                mailto:gkholman@C...
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                        Definitive XSLT & XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:   2002-02-13,14,15,18,21,03-04,05,06,11,15,
-        04-08,09,10,11,05-06,07,09,10,14,15,06-04,07,10,11,13,14


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.