Line breaks and leading spaces in programmatically created work items
Hi RTC developers,
We are programmatically creating work items using the Resource Oriented Work Item API. We set up the description using a source text that contains no enrichments, but does contain line breaks and leading blanks forming ASCII indented lists, e.g.: Items: - line 1 - line 2 - line 2.1 - line 2.2 We found that if we PUT a <dc:description> block containing escaped HTML (with br tags and nbsp entities), we get the formatting we want... But only in the web UI. What we do is this: - We insert <BR/> tags for newlines, which, once escaped, give <br/> - We replaced each leading space with &nbsp; The resulting XML looks like: <dc:description> Items:<br/> &nbsp;&nbsp;-&nbsp;line&nbsp;1<br/> ...etc... </dc:description>(Note: what we submit is actually escaped, so each ampersand within the block is actually replaced by & amp ;) However, even so, we only see the desired result in the Web UI, and only in preview mode. If we click the Edit button on the description field, we see the unescaped HTML. The Eclipse UI always shows the unescaped HTML. I understand the restrictions on HTML, but surely there is a way to create a description with blank lines and leading spaces, isn't it? How do you do that? |
Accepted answer
That is correct, in both Eclipse and the Web in both Edit or Preview modes.
Attached are the results. Frederic Mora selected this answer as the correct answer
Comments Got it. There is a gotcha: the XML quoted by Chris has been unescaped by the forum software.
Frederic Mora
commented Jun 18 '13, 6:53 p.m.
Here is the corresponding description block (warning: a space has been added after each ampersand to avoid interpretation):
<dc:description>Items:& lt;br/& gt;- line 1& lt;br/& gt;- line 2& lt;br/& gt;& #160;& #160;& #160;& #160;& #160;& #160;- line 2.1& lt;br/& gt;& #160;& #160;& #160;& #160;& #160;& #160;- line 2.2</dc:description> |
2 other answers
Millard Ellingsworth (2.5k●1●24●31)
| answered Jun 18 '13, 1:46 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER
As Chris shows by example, if you have valid XHTML content, it should work. Here are some possibly useful references:
http://open-services.net/bin/view/Main/CmSpecificationV2
dcterms:description
Value-type: XMLLiteral
Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content. SHOULD include only content that is valid and suitable inside an XHTML <div> element.
http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-XMLLiteral
http://open-services.net/pipermail/oslc-core_open-services.net/2011-November/001178.html
[this last item includes some discussion about formatted plain text in descriptions]
If there is some sort of defect related to 4.0.1, we should file that, but your fastest relief is likely to move up to 4.0.3 if that is the case.
|
Hi Fred,
This worked for me: <?xml version="1.0" encoding="UTF-8"?><oslc_cm:ChangeRequest xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" rdf:about="https://jazz-server:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/60" xmlns:dc="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" xmlns:oslc_pl="http://open-services.net/ns/pl#"> <dc:description>Items:<br/>- line 1<br/>- line 2<br/>&#160;&#160;&#160;- line 2.1<br/>&#160;&#160;&#160;- line 2.2</dc:description> Comments
Christopher Ricci
commented Jun 18 '13, 12:52 p.m.
By the way, I'm using 4.0.3, not sure if that matters.
Hi Chris,
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.