XMLUpdate - how to write a newline character?

Feb 16, 2012 at 10:28 AM
Edited Feb 16, 2012 at 10:29 AM

I have a bit of an issue updating (what is supposedly) a standard XML file.

Entry is:

  <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=jms/tpiAsyncQueue">
    <attribute name="JNDIName">jms/tpiAsyncQueue</attribute>
    <attribute name="Properties">baseQueueName=PORTALS.ASYNC.QUOTE.IN targetClient=MQ</attribute>
  </mbean>

and the code that currently writes it is:

    <XmlUpdate XmlFileName="\\$(JBOSSServerName)\$(JBOSSJMSWMQDSFile)" Xpath="//connection-factories/mbean[@name='jca.wmq:name=jms/$(JBOSSmbean)']/attribute[@name='Properties']" Value="baseQueueName=$(JBOSSmbeanbaseQName) targetClient=MQ" />

Unfortunately, the JBOSS App reading it seems to need:

  <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=jms/tpiAsyncQueue">
    <attribute name="JNDIName">jms/tpiAsyncQueue</attribute>
    <attribute name="Properties">
               baseQueueName=PORTALS.ASYNC.QUOTE.IN
               targetClient=MQ
    </attribute>
  </mbean>

(i.e. the 2 entries for attribute name="Properties" need to be on seperate lines).

So I updated the XMLUpdate code to:

    <XmlUpdate XmlFileName="\\$(JBOSSServerName)\$(JBOSSJMSWMQDSFile)" Xpath="//connection-factories/mbean[@name='jca.wmq:name=jms/$(JBOSSmbean)']/attribute[@name='Properties']" Value="baseQueueName=%0A%0D$(JBOSSmbeanbaseQName) %0A%0DtargetClient=MQ%0A%0D" />

and the log file showed it correctly:

Task "XmlUpdate"
  Updating Xml Document "\\localhost\C$\app\datasources\jms-wmq-ds.xml".
    1 node(s) selected for update.
  XmlUpdate Wrote: "baseQueueName=
  PORTALS.ASYNC.QUOTE.IN
  targetClient=MQ
  ".
Done executing task "XmlUpdate".

However the actual file did not reflect the return character.

Can anyone help?

Feb 16, 2012 at 10:49 AM

Think I managed to resolve this actually.


Seems you need to do %0D then %0A....

Coordinator
Feb 19, 2012 at 6:19 PM

Thanks for the answer!

Mike