ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vikramjit singh" <vikramjit.si...@mphasis.com>
Subject RE: Doubt in using ENTITY
Date Wed, 30 Oct 2002 04:47:49 GMT
Hi Robert,

Thanks for the explanation, and things are lot more clear, and it is logical
too. Why this question came up, coz i am using my build files in JBuilder
8.0, and if the xml files are not proper, then JBuilder shows an error and
the build file does not run from JBuilder.
>From an earlier post, i was suggested to use Ant 1.6 beta, which has
<import> tags. I just downloaded that, and am gonna use the <import> tag.

Thanks,
Vikram.

-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Robert E. Newby
Sent: Wednesday, October 29, 2003 9:45 PM
To: user@ant.apache.org
Subject: Re: Doubt in using ENTITY


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


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


Mime
View raw message