• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to write a XML file if the dtd file is in the local system?

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the local path is d:\source\callcenter\WEB-INF\aaa.dtd , please tell me how to write the head of the xml file that using the dtd file.
it's all just because my computer cannot directly connect to the internet, so if i use the PUBLIC identifier, the compiler system will tell me that the dtd file cannot not be found. i know i should use the SYSTEM identifier, but i'm not familier with the syntex, please help me.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this -

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "d:\source\callcenter\WEB-INF\aaa.dtd">

In order to ensure the DTD works fine with XML, I suggest that you first make it an inline DTD. Something like this -

<?xml version="1.0"?>
<!DOCTYPE aaa[
<!ELEMENT note (to,from,heading,body)>
...
...
]>
<XMLRootElement>
....
...
</XMLRootElement>

Once this works ie., once you are able to parse the XML and check validity constraints against the DTD, you can strip the DOCTYPE and save it as a .dtd file and reference it in the document( as shown in the top of this post ).
Hope that helps.
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic