2012-02-16 45 views
4

使用撒克逊9.4的.NET版本,我喜欢运行命令行:关闭XML头输出撒克逊

Query.exe -s:myfile.xml -qs:/cruisecontrol/build/msbuild[@success='true']/project[1]/target[@name='GetLatestSource']/message[last()]/text() 

,我得到这样

<?xml version="1.0" encoding="UTF-8"?>375 

我怎么能拒绝的结果关闭XML标题(省略XML声明),以便只输出375作为输出?我检查了the documentation,但也许我只是想念它。

回答

6

想通了......

我需要添加omit-xml-declaration选项:

Query.exe -s:myfile.xml -qs:"declare option saxon:output 'omit-xml-declaration=yes'; /cruisecontrol/build/msbuild[@success='true']/project[1]/target[@name='GetLatestSource']/message[last()]/text()" 

将是实现这一目标的方法之一。

+3

您也可以直接从命令行设置序列化参数,例如, !method = text(这不像omit-xml-declaration一样,它也可以防止<和&被转义) – 2012-02-17 08:51:40