ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Nicholson" <rob...@elastica.com>
Subject RE: Merging XML files
Date Fri, 05 Apr 2002 20:18:54 GMT
That sounds like an interesting problem. Seems to me as though it's
conceptually just merging two disjoint trees which there probably are
many solutions for. I'd wager a guess that XSLT could be used to merge
this but you'd have to be good a XPATH and use the axis
preceeding/sibling etc etc when building your result tree. It wouldn't
be too hard actually you'd just have to recognize that you cannot have
two children of the Entity node. So you'd parse both trees recognizing
the parents you've seen already and when you hit entity you always have
to copy the children.

-----Original Message-----
From: Drew Davidson [mailto:drew@eblox.com] 
Sent: Friday, April 05, 2002 10:56 AM
To: Ant Users List
Subject: Merging XML files

I want to merge two or more XML files into one, so that I can split up
relatively unrelated configurations (struts-config.xml, *.ejb for
example) and merge them together (because the deployment requires that
there be only one struts-config.xml and all related EJBs need to be in
one deployment descriptor).

So say that I have the following two files:

Foo.ejb:
<ejb-jar>
    <enterprise-beans>
        <entity>
            <ejb-name>Foo</ejb-name>
        </entity>
    </enterprise-beans>
</ejb-jar>

Bar.ejb:

<ejb-jar>
    <enterprise-beans>
        <entity>
            <ejb-name>Bar</ejb-name>
        </entity>
    </enterprise-beans>
</ejb-jar>

I want to merge into:

<ejb-jar>
    <enterprise-beans>
        <entity>
            <ejb-name>Foo</ejb-name>
        </entity>
        <entity>
            <ejb-name>Bar</ejb-name>
        </entity>
    </enterprise-beans>
</ejb-jar>


Anyone know of a task to accomplish this?

- Drew


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


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


Mime
View raw message