Hi,
I want to know if Tamino can capture my carriage return in my documents. That is, I have documents like,
xyz
abc (here is a return)
1. def (here is a return)
2. ghi
But after I inserted into tamino, and retrieve using X-Application, how can I change the carriage return to “
”? I tried xapp:display and use javascript to replace “\r\n” to “
” but with no success. I suppose it use the java carriage return “\n”, isn’t it?
Thanks.
Lun
Hello,
If you have a line break within your document (text content of an element) and you want to display this text with X-Appication’s JSP tags, you can set the attribute rawcontent=“true” within your xapp:display tag.
The effect is that the text content is not normalized. However, line breaks are not transformed to HTML tags like
.
Your approach to use Javascript for this transformation of browser side could work with the rawconetnt option.
If not, a ‘Plugin’ which overwrites the default behavior of the ‘getValue’ method could be a solution. A Plugin is a static Java method. This method could read the text of an element are replace the “\n” by an “
”.
Let me know, if the rawcontent flag or your Javascript code does not produce the result you want. Then, we can look for a plugin solution in more detail.
Bye,
Christian.
Hi Christian,
I’m afraid, the rawcontent=“true” is not working properly, at least in my side. Unless my line break is already ignore when the documents are inserted. I can’t see there is any \n (by view html source), if it has, I believe I can see the text contains next line, rather than a 1-line paragraph.
Lun
Hello,
excuse my late reply and that I was not aware of the problem with XApplication 3.1.3 and JDOM Beta 6.
This problem was discussed by a former topic
Formatting lost
Perhaps, switching to JDOM Beta 8 will solve your problems when using rawcontent=“true”.
I will please my colleague Throsten to send you this fix.
Bye,
Christian.
Good, at least I know that the problem can be solved!
Thank you very much christian, hope to get the fix asap.
Hi Lun,
we have added a post in our contribution section,
containing the requested file you are looking for.
Hope this will help you.
Just follow this link: JDom beta 8 patch
Bye
Thorsten
Well, after applying the patch, I can see my documents contains new lines, rather than the before “1-line paragraph” (by html view source).
But I can’t replace the “\n” to “
”, my code should be correct because I can replace “10” to “100”, “1” to “
”, but not “\n” to “
”, it seems that I can’t find the “\n” out. I believe it should be quite easy to fix, but I don’t know the answer. Actually after processed by X-Application, is the carriage return represented by “\n”? Or something like "
", "
"?? I tried most of these, but with no success. Someone know the answer please kindly help me.
Thank you very much!
Lun
Hello,
I don’t know if there is a special encoding for the line break.
My propose is to save the HTML page you receive by your browser. Then, open the page with an editor with can switch to a HEX mode represenation of the displayed content.
Onother way to find out which character comes from Tomcat is to use sniffer which protocols the transfer between your browser and Tomcat.
I described the handling with a Sniffer for protocolling HTTP transfer between X-Application and Tamino. Have a look at this discription if you think if you want to use the HTTP sniffer.
Protocolling the HTTP transfer between Tamino and X-Application
The difference for your use case is: don’t use the HTTP sniffer as a proxy for Tamino but for Tomcat. The remote port for the sniffer is the Tomcat, e.g.
localhost:8080
If you start the sniffer for instance at port 3500, your URL to invoke your application from your Browser is
http://localhost:3500/myApplication/search.jsp.
You don’t have to change anything for your application or configuration!
Hope, this helps you to find out your coding problem.
If you have no success with your Javascript approach, send a new post and we will help you to implement a Plugin that transfers the text content of an element to an adequate HTML representation.
Bye,
Christian.
thanks! I figured out what’s wrong, because I’m ignoring empty string by
if( from == null || from.trim().equals(“”) ) continue;
and “\n” is treated as equals(“”)? anyway, I solved it by a dirty workaround now:
check java.net.URLEncoder.encode(from).trim().equals(“”)
thank you all.
hello lun,
you would at least have to have a “valid” document.
so, write the BR in any one of these two ways:
<BR></BR> or <BR />
hope this helps,
andreas f.