You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Keith Chew <ke...@jungledrum.co.nz> on 2002/02/24 21:48:44 UTC

include file...

Hi

I am using Xerces (version 1.4.4) in my web application, pakaged as a WAR
file.

When running the war from the container, it has to read a struts-config.xml
file. I have edited the file to contain this:

<?xml version="1.0"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd" [

    <!ENTITY part1 SYSTEM "file:part1.xml">
    <!ENTITY part2 SYSTEM "file:part2.xml">
    <!ENTITY part3 SYSTEM "file:part3.xml">
]>

<struts-config>
	<form-beans>
        &part1;
	</form-beans>

	<global-forwards>
        &part2;
	</global-forwards>

	<action-mappings>
        &part3;
	</action-mappings>
</struts-config>

where part1.xml, part2.xml and part3.xml are in the same folder as
struts-config.xml.

I get the exception File part1.xml cannot be found.

Changing the declaration to:

    <!ENTITY part1 SYSTEM "file:C:\projects\webapp\WEB-INF\part1.xml">
    <!ENTITY part2 SYSTEM "file:C:\projects\webapp\WEB-INF\part2.xml">
    <!ENTITY part3 SYSTEM "file:C:\projects\webapp\WEB-INF\part3.xml">

works. However, I would really like to work with relative paths.

Is this a bug, or how do I find the root path? Assuming it is at where the
container is executed from, ie tomcat/bin, this is not acceptable. It should
be from where the file is, ie struts-config.xml. I believe this is the
bahaviour of other parsers.

Keith






---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: include file...

Posted by Laura Hatcher <lh...@argoneng.com>.
You will need to create your own EntityResolver that will translate the system
id or the public id to an InputSource.

Laura

Keith Chew wrote:

> Hi
>
> I am using Xerces (version 1.4.4) in my web application, pakaged as a WAR
> file.
>
> When running the war from the container, it has to read a struts-config.xml
> file. I have edited the file to contain this:
>
> <?xml version="1.0"?>
> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
> Configuration 1.0//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd" [
>
>     <!ENTITY part1 SYSTEM "file:part1.xml">
>     <!ENTITY part2 SYSTEM "file:part2.xml">
>     <!ENTITY part3 SYSTEM "file:part3.xml">
> ]>
>
> <struts-config>
>         <form-beans>
>         &part1;
>         </form-beans>
>
>         <global-forwards>
>         &part2;
>         </global-forwards>
>
>         <action-mappings>
>         &part3;
>         </action-mappings>
> </struts-config>
>
> where part1.xml, part2.xml and part3.xml are in the same folder as
> struts-config.xml.
>
> I get the exception File part1.xml cannot be found.
>
> Changing the declaration to:
>
>     <!ENTITY part1 SYSTEM "file:C:\projects\webapp\WEB-INF\part1.xml">
>     <!ENTITY part2 SYSTEM "file:C:\projects\webapp\WEB-INF\part2.xml">
>     <!ENTITY part3 SYSTEM "file:C:\projects\webapp\WEB-INF\part3.xml">
>
> works. However, I would really like to work with relative paths.
>
> Is this a bug, or how do I find the root path? Assuming it is at where the
> container is executed from, ie tomcat/bin, this is not acceptable. It should
> be from where the file is, ie struts-config.xml. I believe this is the
> bahaviour of other parsers.
>
> Keith
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org