我不确定这是Bugzilla问题还是XML-RPC问题:使用XML-RPC API的Bug.create方法在Bugzilla中创建错误时,如何输入多行描述?
description参数采用字符串值,但是空格(包括换行符)似乎被剥离,我最终得到的是单行描述,而不是多行文本。
以下不起作用:
<?xml version="1.0"?>
<methodCall>
<methodName>Bug.create</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>product</name>
<value><string>Development</string></value>
</member>
<member>
<name>component</name>
<value><string>Component01</string></value>
</member>
<member>
<name>summary</name>
<value><string>Bug created via API</string></value>
</member>
<member>
<name>description</name>
<value>
<string>This bug was created through the Bugzilla XML/RPC interface
Here is the second line of the description
and the third line.</string>
</value>
</member>
<member>
<name>version</name>
<value><string>1</string></value>
</member>
<member>
<name>severity</name>
<value><string>enhancement</string></value>
</member>
<member>
<name>op_sys</name>
<value><string>All</string></value>
</member>
<member>
<name>platform</name>
<value><string>All</string></value>
</member>
<member>
<name>priority</name>
<value><string>P5</string></value>
</member>
<member>
<name>assigned_to</name>
<value><string>example@example.com</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
我最终得到以下描述:
This bug was created through the Bugzilla XML/RPC interfaceHere is the second line of the descriptionand the third line.
答案 0 :(得分:1)
我想出了一种方法:使用base64值而不是字符串值来描述。
如果有人知道不同的方式,请告诉我。
这有效:
<?xml version="1.0"?>
<methodCall>
<methodName>Bug.create</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>product</name>
<value><string>Development</string></value>
</member>
<member>
<name>component</name>
<value><string>Component01</string></value>
</member>
<member>
<name>summary</name>
<value><string>Bug created via API</string></value>
</member>
<member>
<name>description</name>
<value>
<base64>VGhpcyBpcyBsaW5lIG9uZQ0KDQpibGFuayBsaW5lIGFib3ZlDQpUaGlzIGlzIHRoZSB0aGlyZCBsaW5lIG9mIHRleHQ=</base64>
</value>
</member>
<member>
<name>version</name>
<value><string>1</string></value>
</member>
<member>
<name>severity</name>
<value><string>enhancement</string></value>
</member>
<member>
<name>op_sys</name>
<value><string>All</string></value>
</member>
<member>
<name>platform</name>
<value><string>All</string></value>
</member>
<member>
<name>priority</name>
<value><string>P5</string></value>
</member>
<member>
<name>assigned_to</name>
<value><string>xxx@xxx.com</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
结果:
This is line one
blank line above
This is the third line of text