DTD, More Questions

Ok, thanks to IDEA, I now have a DTD. Yeah!

I want to use the same DTD for a bunch of files, so I moved the generated DTD to a file.

How do I use it?

I know that I need some sort of !DOCTYPE declaration that references my file but the IDEA documentation on using DTDs is singularly unhelpful. I searched around on the web and could not find any useable documentation about this issue.

7 comments

Just put the dtd declaration in your xml's header, and put the dtd in the
same dir as you xml file. If you need the DTD to be shared by many files,
then simply put the dtd where it's convenient, and point to it with either
file:/// but that's a bad idea, or just shove the DTD on your web server
and point all the files to it.

This is not an idea issue
R


On 12/1/04 9:42 AM, in article
1023840.1101912126062.JavaMail.itn@is.intellij.net, "Donald McLean"
<dmclean@stsci.edu> wrote:

Ok, thanks to IDEA, I now have a DTD. Yeah!

I want to use the same DTD for a bunch of files, so I moved the generated DTD
to a file.

How do I use it?

I know that I need some sort of !DOCTYPE declaration that references my file
but the IDEA documentation on using DTDs is singularly unhelpful. I searched
around on the web and could not find any useable documentation about this
issue.


0

It IS an IDEA issue if I want the IDEA validator to work.

The problem is that nowhere is there a clear example for "pointing to it" that works in IDEA for a local file.

0

For web based file:

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

For local file:

<!DOCTYPE descriptor-repository PUBLIC "-//Apache Software Foundation//DTD
OJB Repository//EN" "repository.dtd">

Which of those 2 are idea specific?

You're not pointing anything, idea figures it out. In the first case the
dtd will show up in red, hit alt enter, and you get the option of grabbing
the file locally and it will resolve.

Also please look at the IDE | Resources preferences, and you will see that
there is plenty of information on how to setup resources in IDEA, specific
to DTDs. "
In IDEA you can use external resources by mapping a URI
with an actual resource location to use in XML and JSP. Actual
usages of the external resources are provided in the XML DTD
Support <../j2ee/xml/dtdSupport.html> , XML Schema Support
<../j2ee/xml/xmlSchemaSupport.html> and JSP Tag Libraries Support
<../j2ee/jsp/tagLibrariesSupport.html> sections.
To configure external resources select the File | Settings : IDE
Settings menu item (or press  toolbar button), and press
Resources. You will see the following dialog. ...
"

R


On 12/1/04 10:12 AM, in article
14791232.1101913962816.JavaMail.itn@is.intellij.net, "Donald McLean"
<dmclean@stsci.edu> wrote:

It IS an IDEA issue if I want the IDEA validator to work.

The problem is that nowhere is there a clear example for "pointing to it" that
works in IDEA for a local file.


0

I appreciate your help, Robert. Your example was actually more helpful than any I've seen yet.

It would be really nice though if there was a simple description of what the actual format for the DOCTYPE element is, and most especially what values inside the strings after PUBLIC keyword are.

This the version that I got to work:

<!DOCTYPE ACSInstrument PUBLIC "-//something//something else//EN" "istrumentModel.dtd" >

Ok, so I know that the second string is my URI that I mapped using the Resources panel, but as you can tell, I haven't found a clear description of the jiberish in the first string, or even a clear identification of what standard the giberish is supposed to follow.

I finally regenerated the DTD from scratch and "validate" works.

The editor still says that 80% of my XML document is invalid AND it says that my DTD is invalid - the error message is "element not closed".

0

Donald, please be aware that almost everything you're discussing here is
basic XML knowledge and has nothing to do with IDEA itself. You may look
for a description of the DOCTYPE format here:
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-prolog-dtd

Donald McLean wrote:

I appreciate your help, Robert. Your example was actually more helpful than any I've seen yet.

It would be really nice though if there was a simple description of what the actual format for the DOCTYPE element is, and most especially what values inside the strings after PUBLIC keyword are.

This the version that I got to work:

<!DOCTYPE ACSInstrument PUBLIC "-//something//something else//EN" "istrumentModel.dtd" >

Ok, so I know that the second string is my URI that I mapped using the Resources panel, but as you can tell, I haven't found a clear description of the jiberish in the first string, or even a clear identification of what standard the giberish is supposed to follow.

I finally regenerated the DTD from scratch and "validate" works.

The editor still says that 80% of my XML document is invalid AND it says that my DTD is invalid - the error message is "element not closed".

0

That's very odd, I didn't notice a single line on the W3C web site about why IDEA claims that the DTD that IT generated is invalid or why the IDEA editor claims that 80% of my XML file is invalid when the "validate" tool says that there are no errors.

It could be that there are existing requests in Tracker for these problems, but I haven't found them yet - I'll keep looking though.

As to the XML documentation itself: Sure, somewhere in that mess everything that I could possibly want to know is buried, but all I really need to know is on the order of 3 small paragraphs. Is it too much to ask for those three small paragraphs to be added to the IDEA documentation on using DTD's? Nothing big or fancy or exhaustive, just enough so that a neophyte could generate a DTD, move it to a file an put in a valid file reference.

0

It's not a IDEA issue,
if you are worried about the dtd not being recognized by IDEA and its showing up in red colour and you not able to use the editing features of IDEA based on your dtd,
the dtd has to be configured as an external resource.
the way to do it is to have a DOCTYPE declaration like so
"&lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;" and now you have to inform idea where it can find this log4j.dtd, the way to do it is settings --&gt; resource and add an entry "log4j.dtd" in the URI input box and point the location in the location box voila. no RED.
man i have to get a free license from JetBrains i'm doing support work here ;)

0

Please sign in to leave a comment.