ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert E. Newby" <Bob_Ne...@vestmark.com>
Subject Re: Doubt in using ENTITY
Date Wed, 29 Oct 2003 16:15:18 GMT
vikramjit singh wrote:
> 
> Hi,
> 
> I am making a properties.xml file, which holds all the properties and the
> corresponding path.
> I am including the properties.xml file in build.xml like this below
> 
> <!-- Define the target includes for all package types -->
> <!DOCTYPE project [
>     <!ENTITY properties SYSTEM "file:./properties.xml">
> ]>
> 
> <project name="CustomerProfile" default="dist" basedir=".">
> 
>   &properties;
> 
> ...
> </project>
> 
> In my properties file, if i make the xml well formed i.e. enclose the
> properties and path tags in a parent tag, then i get the following error.
> The properties.xml file structure snippet is as below..
> 
> <?xml version="1.0"?>
> 
> <properties>
>     <property environment="env"/>
>     <property name="src" value="src"/>
> ...
> </properties>
> 
> BUILD FAILED
> file:./properties.xml:1: more pseudo attributes is expected.
> 
> But if i remove, <?xml version="1.0"?> and the <properties> tag and dont
> enclose a parent tag, then all runs fine.
> 
> Is this as it is to be done, or am i missing something.
> 
> Regards,
> Vikram.


Vikram,

We do this all the time, with great results.  Here are some code
snippets.

>From a representative build.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
  <!ENTITY build-properties-file SYSTEM "file:build-properties.xml">
  <!ENTITY livespace-build-properties-file SYSTEM
"file:livespace-build-properties.xml">
]>

and:

<project name="Master com.viviport Building and Deployment"
default="usage" basedir="../..">

  <!-- PROPERTIES -->

  <!-- load standard build properties -->
  <property name="top" value="${basedir}/utilities"/>
  &build-properties-file;

etc.

In the referenced build-properties.xml file, both:

<?xml version="1.0" encoding="UTF-8"?>

and:

  <!-- Set path to parent of all project trees -->
  <property name="dir.dev" value="${top}/.."/>
  
  <property name="dir.utilities" value="${dir.dev}/utilities"/>
  <property name="dir.utilities.build" value="${dir.utilities}/build"/>
  <property name="dir.utilities.tools" value="${dir.utilities}/tools"/>
  <property name="dir.utilities.tools.ant"
value="${dir.utilities.tools}/ant"/>
  <property name="dir.utilities.tools.ant.lib"
value="${dir.utilities.tools.ant}/lib"/>

etc.

As you've discovered, since the &build-properties-file; performs textual
inclusion of the external entity's content, the external entity cannot
have a root xml element.

I hope this helps clear things up for you.

Regards,

Bob
--
Robert E. Newby

Principal Software Engineer
Vestmark, Inc.
500 Edgewater Drive, Suite 564
Wakefield, Massachusetts 01880 USA
781-224-3646 | Bob _ Newby @ vestmark . com | www . vestmark . com


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


Mime
View raw message