views:

1327

answers:

10

Hi.

I'm having trouble figuring out how to solve this issue. I have a file called: "urlrewrite.xml" which was automatically generated by spring ROO after running the "controller" command in ROO Shell.

However, I still get the following error:

"Referenced file contains errors (http://tuckey.org/res/dtds/urlrewrite3.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."

Here's the content of the urlrewrite.xml file:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd"&gt;

<urlrewrite default-match-type="wildcard">
    <rule>
        <from>/resources/**</from>
        <to last="true">/resources/$1</to>
    </rule>
    <rule>
        <from>/static/WEB-INF/**</from>
        <set type="status">403</set>
        <to last="true">/static/WEB-INF/$1</to>
    </rule>
    <rule>
        <from>/static/**</from>
        <to last="true">/$1</to>
    </rule>
    <rule>
        <from>/</from>
        <to last="true">/app/index</to>     
    </rule>
    <rule>
        <from>/app/**</from>
        <to last="true">/app/$1</to>
    </rule>
    <rule>
        <from>/**</from>
        <to>/app/$1</to>
    </rule>
    <outbound-rule>
        <from>/app/**</from>
        <to>/$1</to>
    </outbound-rule>    
</urlrewrite>

Any thoughts on how to get rid of this error?

A: 

did some googling "sample dtd" 4th or 5th result was http://www.xmlfiles.com/dtd/dtd_examples.asp

the sample had a

<!DOCTYPE TVSCHEDULE [ 
<!ELEMENT TVSCHEDULE (CHANNEL+)>
..
..
]>

the url rewrite dtd started with

<!ELEMENT urlrewrite ((rule|class-rule)*, outbound-rule*, catch*)>

i issued a wget for ""http://tuckey.org/res/dtds/urlrewrite3.0.dtd"" and opened in in sts, yup, its red.

added at the top

<!DOCTYPE urlrewrite [

and ad the bottom

]>

and its no longer red.

so i suggest,

  1. get the dtd
  2. alter it
  3. save it in the same directory as the xml
  4. alter the xml to use the dtd in the same directory.
Titi Wangsa bin Damhore
A: 

I got the DTD ... saved it in the same directory as the xml and altered it. now there's a red in the DTD and xml

The markup declarations contained or pointed to by the document type declaration must be well-formed. urlrewrite3.0.dtd

Referenced file contains errors (....App/src/main/webapp/WEB-INF/urlrewrite3.0.dtd). ..

Please upload your xml file and dtd file.

santhosh S
+1  A: 

Hi,

In IntelliJ IDEA, you can select the red DTD URI, hit Alt-Enter, then choose "Fetch external resource".

In Eclipse, you can add the entry to the XML catalog under: Preferences -> XML -> XML Catalog.

I hope this helps.

schuess
+5  A: 

Just change 3.0 to 3.2

<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
    "http://tuckey.org/res/dtds/urlrewrite3.2.dtd"&gt;
does not solve.
Ahmet Alp Balkan
it does solve the problem, but maybe you need to tell eclipse to revalidate the document
Janning
+3  A: 

http://forum.springsource.org/showthread.php?t=90962 led me to the right path.

If you download the DTD from http://tuckey.org/res/dtds/urlrewrite3.0.dtd you will find that sometimes it is correct and sometimes it is empty HTML. Eclipse caches what it downloads either way. You can fix the problem two ways:

  1. Download the DTD file yourself, verify that it looks like an XML DTD, store it locally, and point at this in your urlrewrite.xml header.
  2. Go to Preferences -> General -> Network Connections -> Cache and remove the cached DTD, then revalidate the XML (Right-click -> Validate). Repeat until you get a good copy of the DTD cached.
sosiouxme
#2 worked nicely for me, thanks a million!
Andrew Swan
+1  A: 

Hi I just solved this based on a few of these answers here:

The steps I followed were:
1. Downloaded the urlrewrite3.2.dtd
2. saved it locally to ...war/WEB-INF/urlrewrite3.2.dtd
3. pointed my URLrewrite file to the local copy
4. removed the cached version (Preferences>General>Network Connections>Cache)
5. Revalidated the XML

Note: I initially tried editing the file as was suggested by Titi Wangsa bin Damhore but there i got a validation error in the dtd file. I removed that followed the steps above and boom. Problem solved. Thanks to those who contributed ideas.

Blockquote

Nearmars
A: 

I used user374708 method and cleared network cahce, like shown in Nearmars post

janis.abele
A: 

That issue has been fixed for the next release... https://jira.springsource.org/browse/ROO-1129

Regards, Gordon twitter.com/gdickens

Gordon Dickens
+1  A: 

Changing 3.0 to 3.2 worked for me...

masa-255
A: 

set the dtd url to "http://urlrewritefilter.googlecode.com/svn-history/r275/trunk/src/java/org/tuckey/web/filters/urlrewrite/dtds/urlrewrite3.0.dtd", it works.

saymo