How to replace value of an XML field using Ant?

后端 未结 1 1127
北荒
北荒 2021-01-21 15:36

In an Ant script, I need to replace the value of javax.persistence.jdbc.url property in the following persistence.xml file.



        
1条回答
  •  不知归路
    2021-01-21 16:18

    As mentioned by @Rao, your problem is the xpath not dealing properly with namespaces. The syntax that utilizes ":" hasn't worked consistently for me. As many other XmlTask answers have shown on this site, you need to use the //*[local-name()='persistence'] syntax instead. Also, attribute can be referenced with the @name syntax. Last, if you want to replace the value of an attribute, don't use

    Please try:

    
       
      
    

    0 讨论(0)
提交回复
热议问题