• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Binary data - base64 encoded strings - need help please....

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking for some help with binary data. I have a string, in my input, which I think is base64 encoded. While I can write elaborate code to spit it out as a ascii string, I was wondering if there is a way to interpret (de-code) the base64 string using any existing XSL functions.
Thanks.
- madhav
ps:
For example:
If I have an element, in my input, like this:
<Base64EncodedString>
JFHBDSLKJ3398JBKJSDAHBLKF0237-83IF7DM20
</Base64EncodedString>
I am curious if there is a way to decode it in my Style Sheet and output an equivalent ascii string.
As always, Thanks for your help.
- madhav
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I just read the other Binary decode post and am using the search at the top and I will try to read the 18 posts but incase anyone of you already solved similar issues, please please please.....
- madhav
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call Java code within XSLT thereby using the JDK's decoder class to decode it.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you provide an example or a link to get more info on this please....
I din't know we could call Java code from XSL...forgive my ignorance... :roll:
Thanks.
- madhav
 
Christophe Lee
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This article is good:
http://www.javaworld.com/javaworld/jw-12-2001/jw-1221-xslt.html
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Madhav,
The library you need to decode the base64 string is the Java Mail API. You may download it from the following page:
http://java.sun.com/products/javamail/
Inside the javax.net package, you will find the MimeUtility that serves the purpose of encoding/decoding text based on mime types.
IMHO, it's better to write a generic class that fits what you need to do in your XSLT, rather than cluttering your XSLT code with lots of java calls.
For instance, you could write a class similar to this:

Assuming you're using Xalan as your XSLT processor:

This should work, though I have not tried it ;-)
Best luck
[ November 18, 2002: Message edited by: Beno�t d'Oncieu ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Christophe Beno�t, awesome article.
- madhav
 
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic