I am trying to update an attribute value to append a suffix.  I have
found to create the desired text value I had to create a temporary node
and set the desired text value.  I have this value set properly (can see
it with the <print> function) however I cannot get the <replace> to work
with my buffer..it keeps giving the error Attempt to insert prior to
root node.  Any ideas??

<xmltask
source="${jarSourceDirectory}ejbModule/META-INF/ibm-ejb-jar-bnd.xmi"
dest="c:\tmp\ibm-ejb-jar-bnd_TEMP.xmi">
    <!-- First, just get a node added with the context root suffix.
Need to do this to manipulate attributes -->
    <insert path="/ejbbnd:EJBJarBinding" xml="&lt;damon/&gt;"
position="under"/>
    <copy
path="/ejbbnd:EJBJarBinding/ejbBindings/@listenerInputPortName"
buffer="namedBuffer" attrValue="true"/>
    <insert path="/ejbbnd:EJBJarBinding/damon" buffer="namedBuffer"
position="under"/>
    <insert path="/ejbbnd:EJBJarBinding/damon"
xml="${contextRootSuffix}" position="under"/>
    <copy path="/ejbbnd:EJBJarBinding/damon/text()" buffer="namedBuffer"
append="false"/>
    <print buffer="namedBuffer"/>
    
    <!-- THIS works ok... -->
    <replace
path="/ejbbnd:EJBJarBinding/ejbBindings/@listenerInputPortName"
withText="testTextReplace"/>
    <print
path="/ejbbnd:EJBJarBinding/ejbBindings/@listenerInputPortName"/>
    
    <!-- THIS does not work?? -->
    <replace
path="/ejbbnd:EJBJarBinding/ejbBindings/@listenerInputPortName"
withBuffer="namedBuffer"/>
    
    <!-- cleanup of temp node created for attibute mod -->
    <remove path="/ejbbnd:EJBJarBinding/damon"/>
</xmltask>

Here is the output when run through ANT:
     [xmltask] { buffer 'namedBuffer' output
     [xmltask] ListenerPort_INSURITY_COVERAGE_VERIFYQA
     [xmltask] } buffer 'namedBuffer' output
     [xmltask] { node output
     [xmltask] testTextReplace
     [xmltask] } node output
     [xmltask] Attempt to insert prior to root node



Starting XML
<?xml version="1.0" encoding="UTF-8"?>
<ejbbnd:EJBJarBinding xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"; xmlns:ejbbnd="ejbbnd.xmi"
xmlns:ejb="ejb.xmi" xmi:id="EJBJarBinding_1160662690292">
  <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_ID"/>
  <ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding"
xmi:id="MessageDrivenBeanBinding_1160662690292"
listenerInputPortName="ListenerPort_INSURITY_COVERAGE_VERIFY">
    <enterpriseBean xmi:type="ejb:MessageDriven"
href="META-INF/ejb-jar.xml#CoverageVerificationMDBBean"/>
    <resRefBindings xmi:id="ResourceRefBinding_1160666147208"
jndiName="jms/BigironJmsConnectionFactory">
      <bindingResourceRef
href="META-INF/ejb-jar.xml#ResourceRef_1160666147208"/>
    </resRefBindings>
    <resRefBindings xmi:id="ResourceRefBinding_1160666147209"
jndiName="jms/Queue_INSURITY_COVERAGE_VERIFY_REPLY">
      <bindingResourceRef
href="META-INF/ejb-jar.xml#ResourceRef_1160666147209"/>
    </resRefBindings>
  </ejbBindings>
</ejbbnd:EJBJarBinding>


<HTML><BODY>

DISCLAIMER:  This message and accompanying documents are covered by the 
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, and contains 
information intended for the specified individual(s) only. This information is 
confidential. If you are not the intended recipient or an agent responsible for 
delivering it to the intended recipient, you are hereby notified that you have 
received this document in error and that any review, dissemination, copying, or 
the taking of any action based on the contents of this information is strictly 
prohibited. If you have received this communication in error, please notify us 
immediately by e-mail, and delete the original message.
</BODY></HTML>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Reply via email to