[ 
https://issues.jenkins-ci.org/browse/JENKINS-12742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159186#comment-159186
 ] 

Joshua Niehus commented on JENKINS-12742:
-----------------------------------------

I extended the token macro plugin on my fork to include this:
https://github.com/jniehus/token-macro-plugin

Im sure I violated many laws from the Kingdom of nouns but it seems to work. 
Use as requested:
${XML, file="pom.xml", xpath="/project/version/text()"} -> 1.6-SNAPSHOT

I dont like to kill jobs for simple mistakes or in cases where to token value 
is used in a trivial way so I passed off most of the errors into the token's 
string. 
*For example, the token will read 'XML not well formed' on files where the xml 
is missing a node/endNode.
*In the event your xpath expression catches more that one value, the token 
string will become a semicolon separated string of all the values...
*For erroneous xpath expressions, i set the token to read as 'Error reading 
<filename>. <xpathExpression> is probably messed up
                
> XML Reader feature
> ------------------
>
>                 Key: JENKINS-12742
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-12742
>             Project: Jenkins
>          Issue Type: New Feature
>          Components: token-macro
>            Reporter: Eugene Gligalov
>            Assignee: Kohsuke Kawaguchi
>
> Hi,
> Would be nice if plugin has possibility to read xml using xpath, this might 
> be useful for reading version from maven pom.xml it might look like:
> ${PROPFILE,file="somepath/pom.xml",xpath="/project/version/text()"}
> Regards
> Eugene Gligalov

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to