File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes How do I recover the String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How do I recover the String" Watch "How do I recover the String" New topic
Author

How do I recover the String

Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Don't ask why. But the database I got has a string of something like
<b>Item 1</b>
So I have to convert it into xml like this:
<b>Item 1</b>
After transform with XSL, it will output the same into HTML's source
<b>Item 1</b>
Then in browser it looks like
<b>Item 1</b>
Of course, you guessed right. That isn't what we wanted. We want Item 1 to be bold in html. In otherwords, we want <b>Item 1</b> to be in the source of Html.
How do you this? I guess I have to convert < and > into < and > into xml as required by xml. Can I do soemthing in XSLT to convert them back to < and > ?
thx
-TY


Tony Yan<br /> <br />IBM Certified Developer XML and Related Technology<br />Sun Certified Web Component Developer For J2EE Platform<br />Sun Certified Programmer For Java 2 Platform
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
We need a decoder to understand your question.


Spritle Software Blogs
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Don't ask why. But the database I got has a string of something like
<b>Item 1</b>
So I have to convert it into xml like this:
<![CDATA[
<b>Item 1</b>
]]>
After transform with XSL, it will output the same into HTML's source
<![CDATA[
<b>Item 1</b>
]]>
Then in browser it looks like
<b>Item 1</b>
Of course, you guessed right. That isn't what we wanted. We want Item 1 to be bold in html. In otherwords, we want <b>Item 1</b> to be in the source of Html.
How do you this? I guess I have to convert < and > into < and > into xml as required by xml. Can I do soemthing in XSLT to convert them back to < and > ?
thx
-TY
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Sorry for the confusion. In the last post, what ever in CDATA
< should be & lt ; (ignore the space)
> should be & gt ; (ignore the space)

Thx
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi Toni,
Actually why u need to convert it into XML,why don't you read the database directly,retrieve the specific details,write to a HTML file.All this can be done using java or whatever language you use.
If you learning how to do such process in XSLT may be this FAQ will help you http://www.dpawson.co.uk/xsl/xslfaq.html
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Thanks for the input. We are actually doing what you said. But we also are trying out the xsl solution.
As for my problem, I have used the CDATA section to put all my data in w/o coverting. In xsl, I used disable-output-escaping="yes" to output whatever is in CDATA. This seems to work fine now. So basically, whatever is in DB as raw string will go directly into html source. This actually save some process time.
Thanks again.
-Tony
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi Tony,
I still don't see the need for XSL their,can you tell me why you opted xsl,because the conversion done using xsl may slowdown your processing time escp., when you use XALAN,but with MSXML,it may be fast.
Regards
Balaji
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
There are a lot of business presentation logic to my data. In other words, the current Java solution are also slow with data manipulation. Indeed, the transformation is slow too for xalan (needs improve on my .xsl). But the speed are about the same for them. But for the developers, the xsl solution seems more flexible when users ask for changes in presentation. And belive me the codes are much simpler with xsl. I hate to change the servlet when they want to have an extra table or diff. look. Just change it in .xsl file.
Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I recover the String