Issue with setting up DTD file for my XML files in IntelliJ

Hi All,

I have an issue with the DTD I generated (from IntelliJ) for all my xml files that store sql queries for my project.
I the top of each xml file now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE statements SYSTEM "sql.dtd">

However IntelliJ marks the "sql.dtd" in red and displays message "URI is not registered (Settings | IDE Settings | Resources)".
I did register the URI to point to the local file system path to the sql.dtd which is in the WEB-INF folder of my project and it's still marked as red.

Why is that? Every where I look everybody seems to just use file name and it works for them.
I also tried to locate the sql.dtd file in the same package as all the xml files that point to it but there's still same issue.

Please advice.

Thanks,
goe

4 comments
Comment actions Permalink

Does your dtd has at least one element definition?

goe wrote:

Hi All,

I have an issue with the DTD I generated (from IntelliJ) for all my xml files that store sql queries for my project.
I the top of each xml file now looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE statements SYSTEM "sql.dtd">

However IntelliJ marks the "sql.dtd" in red and displays message "URI is not registered (Settings | IDE Settings | Resources)".
I did register the URI to point to the local file system path to the sql.dtd which is in the WEB-INF folder of my project and it's still marked as red.

Why is that? Every where I look everybody seems to just use file name and it works for them.
I also tried to locate the sql.dtd file in the same package as all the xml files that point to it but there's still same issue.

Please advice.

Thanks,
goe



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Below is the entire dtd file I want to use. As I mentioned it was generated by IntelliJ itself based on one of the xml files.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE statements [
<!ELEMENT statements (statement)*>
<!ELEMENT statement (token)*>
<!ATTLIST statement
id CDATA #REQUIRED>
<!ELEMENT token (#PCDATA)>
<!ATTLIST token
name CDATA #REQUIRED>
]>

0
Comment actions Permalink

This seems not to be DTD file but xml one, dtd would be

<!ELEMENT statements (statement)*>
<!ELEMENT statement (token)*>
<!ATTLIST statement
id CDATA #REQUIRED>
<!ELEMENT token (#PCDATA)>
<!ATTLIST token
name CDATA #REQUIRED>


goe wrote:

Below is the entire dtd file I want to use. As I mentioned it was generated by IntelliJ itself based on one of the xml files.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE statements [
<!ELEMENT statements (statement)*>
<!ELEMENT statement (token)*>
<!ATTLIST statement
id CDATA #REQUIRED>
<!ELEMENT token (#PCDATA)>
<!ATTLIST token
name CDATA #REQUIRED>
]>



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Oh, when I generated it from IntelliJ I was under the impression that was th ecode for the standalone dtd file where this is the code I should be using in the actuall xml file itself. OK, your dtd code worked 100% for me.

Thank you for your help!

0

Please sign in to leave a comment.