The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 XML Manipulation using XMLTask
Subject:  XmlTask (com.oopsconsultancy.xmltask.ant.XmlTask) bug with attributes within node
Date:  2007-06-05 08:03:12
From:  renato78


Using a source file like this (ejb-jar.xml) I cannot insert a section for my resource reference.
I've found out that xmltask works fine if the root element (ejb-jar) doesn't contain any attribute.

I use xmltask in the following way:
<xmltask source="ejb-jar.xml" dest="ejb-jar-modified.xml">
<insert path="/ejb-jar/enterprise-beans/session[@id='Module']" file="resReferences.xml"/>
</xmltask>


If the source file has the root element (ejb-jar) without attribute, it works fine otherwise it seems that the searched element is not found and then no modification have applied to output file.

Source file as follows:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>lwm.mss.process.transferEJB</display-name>
<enterprise-beans>

<session id="Module">
<description>Module</description>
<ejb-name>Module</ejb-name>
<local-home>com.ibm.wsspi.sca.ejb.module.ServiceLocalHome</local-home>
<local>com.ibm.wsspi.sca.ejb.module.ServiceLocal</local>
<ejb-class>com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>


<ejb-ref id="import.ImportLDAPIntf">
<description>sca/import/ImportLDAPIntf</description>
<ejb-ref-name>sca/import/ImportLDAPIntf</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.ibm.wsspi.sca.ejb.module.ServiceHome</home>
<remote>com.ibm.wsspi.sca.ejb.module.ServiceRemote</remote>
</ejb-ref>
<ejb-ref id="import.ImportBRIntf">
<description>sca/import/ImportBRIntf</description>
<ejb-ref-name>sca/import/ImportBRIntf</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.ibm.wsspi.sca.ejb.module.ServiceHome</home>
<remote>com.ibm.wsspi.sca.ejb.module.ServiceRemote</remote>
</ejb-ref>

<!-- extension-point service-ref -->

<!-- extension-point resource-ref -->

</session>
</ejb-jar>

 Feed java.net RSS Feeds