You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jason Rosenberg <ja...@squaretrade.com> on 2000/11/29 16:09:11 UTC

Re: "include" equivalent in ant?

Can someone explain how this works?  My XML book doesn't
seem to cover any syntax anything like this:

--- cut ---
<?xml version="1.0"?>

<!DOCTYPE project [
  <!ENTITY buildFW SYSTEM "buildFW.inc">
  <!ENTITY buildHO SYSTEM "buildHO.inc">
%buildFW;
%buildHO;
]>

  <target name="performBuild">
    &buildFW;
    &buildHO;
[...]
--- cut ---

Jason


Any example of properties files for the filter task?

Posted by Fajian Shi <fs...@saltare.com>.
I am pretty inexperienced in Java and Ant.

My question is how the general look of properties files? The file can be
used in filter task or property tasks, such as:

<filter filterfile="deploy_env.properties" />

<property file="build.properties" />

I imagine the following example file might serve for both tasks,

# my properties file
java.home=e:\jdk13
@mynametoken@=myname
@passwd@=password

#EOF

This will set the ${java.home} to e:\jdk13, replacing @mynametoken@ with
myname, am I right?

Thanks!

++Fajian


Re: "include" equivalent in ant?

Posted by Tom Davies <to...@optushome.com.au>.
On Mon,  4 Dec 2000 18:58, you wrote:
> Tom Davies <to...@optushome.com.au> wrote:
> > Thanks for that description -- I was just about to ask that
> > question!
> >
> > I find that if I use an absolute pathname, i.e.
> >
> > <!ENTITY buildFW SYSTEM "/foo/bar/buildFW.inc">
> >
> > I get an exception:
>
> Does
>
> <!ENTITY buildFW SYSTEM "file:///foo/bar/buildFW.inc">
>
> work? Having three '/'s in sequence is not a type BTW.
>
> Stefan

Stefan,

    Thanks, that does work -- in fact it works with two slashes as well, 
which I really should have tried...

Thanks again,
    Tom

-- 
Tom Davies -- tomdavies@optushome.com.au

http://members.optushome.com.au/tomdavies

Re: "include" equivalent in ant?

Posted by Stefan Bodewig <bo...@apache.org>.
Tom Davies <to...@optushome.com.au> wrote:

> Thanks for that description -- I was just about to ask that
> question!
> 
> I find that if I use an absolute pathname, i.e.
> 
> <!ENTITY buildFW SYSTEM "/foo/bar/buildFW.inc">
> 
> I get an exception:
> 

Does 

<!ENTITY buildFW SYSTEM "file:///foo/bar/buildFW.inc">

work? Having three '/'s in sequence is not a type BTW.

Stefan

Re: "include" equivalent in ant?

Posted by Tom Davies <to...@optushome.com.au>.
Thanks for that description -- I was just about to ask that question!

I find that if I use an absolute pathname, i.e.

<!ENTITY buildFW SYSTEM "/foo/bar/buildFW.inc">

I get an exception:

java.lang.InternalError
        at com.sun.xml.parser.Parser.parseSystemId(Parser.java:2421)
        at com.sun.xml.parser.Parser.maybeExternalID(Parser.java:2390)
        at com.sun.xml.parser.Parser.maybeEntityDecl(Parser.java:2301)
        at com.sun.xml.parser.Parser.maybeMarkupDecl(Parser.java:1181)
        at com.sun.xml.parser.Parser.maybeDoctypeDecl(Parser.java:1113)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:481)
        at com.sun.xml.parser.Parser.parse(Parser.java:284)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:126)
        at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:104)
        at 
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
        at org.apache.tools.ant.Main.runBuild(Main.java:402)
        at org.apache.tools.ant.Main.main(Main.java:149)    


It works fine if I just use a filename.

Any ideas?

Tom

-- 
Tom Davies -- tomdavies@optushome.com.au

http://members.optushome.com.au/tomdavies

Re: "include" equivalent in ant?

Posted by Stefan Bodewig <bo...@apache.org>.
Jason Rosenberg <ja...@squaretrade.com> wrote:

> Can someone explain how this works?  My XML book doesn't
> seem to cover any syntax anything like this:

its coming right there from SGML. If your book covers DTDs and
internal entity sets, search there.

> 
> --- cut ---
> <?xml version="1.0"?>
> 
> <!DOCTYPE project [

should be clear, yes?

>   <!ENTITY buildFW SYSTEM "buildFW.inc">

define a new entity named buildFW (entities are these &foo; things
like &gt; - &gt; derefences the entity gt). Wherever you put &buildFW;
in your XML file it is going to be replaced by the content of the file
"buildFW.inc".

>   <!ENTITY buildHO SYSTEM "buildHO.inc">

Same

> %buildFW;
> %buildHO;

doesn't make any sense here, you can simply remove it.

> ]>

close the doctype definition.

> 
>   <target name="performBuild">
>     &buildFW;

insert the content of buildFW.inc. In this example it probably holds
tasks, something like

<depend srcdir="${src}" ...>
<javac srcdir="${src}" ...>

and so on.

What is important to note here is that the content is included at
parser time, to Ant it looks exactly the same as if you had pasted the
content there. The XML Parser is performing the include, not Ant.

Stefan