Dear all
In my application I store some base64 encoded binaries to the eXist db. Amongst them also png/jpeg images. I want to show preview of this images in the Xform. I also might want to save other binaries to the files. The question is simple, how one decodes base64 in Orbeon? I have tried http and file serializers, but it's not clear if they are capable of decoding at all. Thanks, -Taras. -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Taras,
Le mercredi 04 janvier 2006 à 18:36 +0100, Taras Bahnyuk a écrit : > Dear all > > In my application I store some base64 encoded binaries to the eXist db. > Amongst them also png/jpeg images. > I want to show preview of this images in the Xform. > I also might want to save other binaries to the files. > > The question is simple, how one decodes base64 in Orbeon? Base64 is what is used for non XML documents (see http://www.orbeon.com/ops/doc/reference-formats). If you want to treat a base64 encoded data as a document, you just need to wrap up this data in "document" element so that it looks like: <document xsi:type="xs:base64Binary" content-type="image/jpeg"> /9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q== </document> If it's a query result, you should be able to rewrite your query to get this type of document directly as a result. After that, you can pass this to the HTTP or file serializer and you shouldn't have any problem! Hope this helps. Eric -- Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Taras Bahnyuk
Eric,
Thanks for quick reply. As a matter of fact I did the following: <p:processor name="oxf:file-serializer"> <p:input name="config"> <config> <file>test.jpg</file> <directory>e:</directory> <content-type>image/jpg</content-type> </config> </p:input> <p:input name="data" href="#instance#xpointer(/form/attachmentList/attachment/file)"/> </p:processor> And this is what I received in response instead of my test.jpg file Type class org.orbeon.oxf.common.ValidationException Message oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43 : Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) : oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43: Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) Location oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl Line 14 Column 43 Stack Trace -----Original Message----- From: Eric van der Vlist [mailto:[hidden email]] Sent: woensdag 4 januari 2006 18:45 To: [hidden email] Subject: Re: [ops-users] Base64 decoder Taras, Le mercredi 04 janvier 2006 à 18:36 +0100, Taras Bahnyuk a écrit : > Dear all > > In my application I store some base64 encoded binaries to the eXist db. > Amongst them also png/jpeg images. > I want to show preview of this images in the Xform. > I also might want to save other binaries to the files. > > The question is simple, how one decodes base64 in Orbeon? Base64 is what is used for non XML documents (see http://www.orbeon.com/ops/doc/reference-formats). If you want to treat a base64 encoded data as a document, you just need to wrap up this data in "document" element so that it looks like: <document xsi:type="xs:base64Binary" content-type="image/jpeg"> /9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q== </document> If it's a query result, you should be able to rewrite your query to get this type of document directly as a result. After that, you can pass this to the HTTP or file serializer and you shouldn't have any problem! Hope this helps. Eric -- Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Taras Bahnyuk
Oh, another addition,
This is what my document looks like: <attachment id="26D83DD0-6773-F334-6C64-D22ECE291F70"> <file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" filename="C:\Documents and Settings\tbahnyuk\Desktop\i000772_big.jpg" mediatype="image/pjpeg" size="39883" xsi:type="xs:base64Binary">/9j/4QDmRXhpZgAASUkqAAgAAAAFABIBAwABAAAAAQAAADEBAgAcAAAASgAAADIBAgAUAAAAZgAA ABMCAwABAAAAAQAAAGmHBAABAAAAegAAAAAAAABBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA MjAwNDoxMDowMSAxODoyNTowMAAFAACQBwAEAAAAMDIxMJCSAgAEAAAANjE4AAKgBAABAAAAIAMA </file> </attachment> -----Original Message----- From: Eric van der Vlist [mailto:[hidden email]] Sent: woensdag 4 januari 2006 18:45 To: [hidden email] Subject: Re: [ops-users] Base64 decoder Taras, Le mercredi 04 janvier 2006 à 18:36 +0100, Taras Bahnyuk a écrit : > Dear all > > In my application I store some base64 encoded binaries to the eXist db. > Amongst them also png/jpeg images. > I want to show preview of this images in the Xform. > I also might want to save other binaries to the files. > > The question is simple, how one decodes base64 in Orbeon? Base64 is what is used for non XML documents (see http://www.orbeon.com/ops/doc/reference-formats). If you want to treat a base64 encoded data as a document, you just need to wrap up this data in "document" element so that it looks like: <document xsi:type="xs:base64Binary" content-type="image/jpeg"> /9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q== </document> If it's a query result, you should be able to rewrite your query to get this type of document directly as a result. After that, you can pass this to the HTTP or file serializer and you shouldn't have any problem! Hope this helps. Eric -- Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Taras Bahnyuk
What version of OPS are you using?
-Erik Taras Bahnyuk wrote: > Eric, > > Thanks for quick reply. > As a matter of fact I did the following: > > <p:processor name="oxf:file-serializer"> > <p:input name="config"> > <config> > <file>test.jpg</file> > <directory>e:</directory> > <content-type>image/jpg</content-type> > </config> > </p:input> > <p:input name="data" href="#instance#xpointer(/form/attachmentList/attachment/file)"/> > </p:processor> > > > And this is what I received in response instead of my test.jpg file > > Type class org.orbeon.oxf.common.ValidationException > Message oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43 : Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) : oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43: Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) > Location oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl > Line 14 > Column 43 > Stack Trace > > > > > > > -----Original Message----- > From: Eric van der Vlist [mailto:[hidden email]] > Sent: woensdag 4 januari 2006 18:45 > To: [hidden email] > Subject: Re: [ops-users] Base64 decoder > > Taras, > > Le mercredi 04 janvier 2006 à 18:36 +0100, Taras Bahnyuk a écrit : > >>Dear all >> >>In my application I store some base64 encoded binaries to the eXist db. >>Amongst them also png/jpeg images. >>I want to show preview of this images in the Xform. >>I also might want to save other binaries to the files. >> >>The question is simple, how one decodes base64 in Orbeon? > > > Base64 is what is used for non XML documents (see > http://www.orbeon.com/ops/doc/reference-formats). > > If you want to treat a base64 encoded data as a document, you just need > to wrap up this data in "document" element so that it looks like: > > <document xsi:type="xs:base64Binary" content-type="image/jpeg"> > /9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q== > </document> > > If it's a query result, you should be able to rewrite your query to get > this type of document directly as a result. > > After that, you can pass this to the HTTP or file serializer and you > shouldn't have any problem! > > Hope this helps. > > Eric > > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Taras Bahnyuk
Le mercredi 04 janvier 2006 à 19:00 +0100, Taras Bahnyuk a écrit :
> Eric, > > Thanks for quick reply. > As a matter of fact I did the following: > > <p:processor name="oxf:file-serializer"> > <p:input name="config"> > <config> > <file>test.jpg</file> > <directory>e:</directory> > <content-type>image/jpg</content-type> > </config> > </p:input> > <p:input name="data" href="#instance#xpointer(/form/attachmentList/attachment/file)"/> > </p:processor> > > > And this is what I received in response instead of my test.jpg file > > Type class org.orbeon.oxf.common.ValidationException > Message oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43 : Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) : oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl, line 14, column 43: Error unexpected character literal. expecting: application/xml,text/html,text/plain,text/xml(schema: http://orbeon.org/oxf/xml/file-serializer-config) > Location oxf:/PCSentry_DEV/detail/detail-xforms-model.xpl > Line 14 > Column 43 > Stack Trace http://www.orbeon.com/ops/doc/processors-serializers#d1102965e84 says: "The content-type element is optional. The default is application/xml. Other valid values are text/html and text/plain." and you're giving it "image/jpg"... That would work with the HTTP serializer but not with the file serializer :-( ! Eric -- Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Taras Bahnyuk
Your document will have to look like what Eric showed below for the File
serializer or HTTP serializer to understand it: <document xsi:type="xs:base64Binary" content-type="image/jpeg"> ... Base64 stuff ... </document> -Erik Taras Bahnyuk wrote: > Oh, another addition, > This is what my document looks like: > > <attachment id="26D83DD0-6773-F334-6C64-D22ECE291F70"> > <file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" filename="C:\Documents and Settings\tbahnyuk\Desktop\i000772_big.jpg" mediatype="image/pjpeg" size="39883" xsi:type="xs:base64Binary">/9j/4QDmRXhpZgAASUkqAAgAAAAFABIBAwABAAAAAQAAADEBAgAcAAAASgAAADIBAgAUAAAAZgAA ABMCAwABAAAAAQAAAGmHBAABAAAAegAAAAAAAABBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA MjAwNDoxMDowMSAxODoyNTowMAAFAACQBwAEAAAAMDIxMJCSAgAEAAAANjE4AAKgBAABAAAAIAMA > </file> > </attachment> > > > > > > -----Original Message----- > From: Eric van der Vlist [mailto:[hidden email]] > Sent: woensdag 4 januari 2006 18:45 > To: [hidden email] > Subject: Re: [ops-users] Base64 decoder > > Taras, > > Le mercredi 04 janvier 2006 à 18:36 +0100, Taras Bahnyuk a écrit : > >>Dear all >> >>In my application I store some base64 encoded binaries to the eXist db. >>Amongst them also png/jpeg images. >>I want to show preview of this images in the Xform. >>I also might want to save other binaries to the files. >> >>The question is simple, how one decodes base64 in Orbeon? > > > Base64 is what is used for non XML documents (see > http://www.orbeon.com/ops/doc/reference-formats). > > If you want to treat a base64 encoded data as a document, you just need > to wrap up this data in "document" element so that it looks like: > > <document xsi:type="xs:base64Binary" content-type="image/jpeg"> > /9j/4AAQSkZJRgABAQEBygHKAAD/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4R ... KKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q== > </document> > > If it's a query result, you should be able to rewrite your query to get > this type of document directly as a result. > > After that, you can pass this to the HTTP or file serializer and you > shouldn't have any problem! > > Hope this helps. > > Eric > > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Taras Bahnyuk
Le mercredi 04 janvier 2006 à 19:05 +0100, Taras Bahnyuk a écrit :
> Oh, another addition, > This is what my document looks like: > > <attachment id="26D83DD0-6773-F334-6C64-D22ECE291F70"> > <file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" filename="C:\Documents and Settings\tbahnyuk\Desktop\i000772_big.jpg" mediatype="image/pjpeg" size="39883" xsi:type="xs:base64Binary">/9j/4QDmRXhpZgAASUkqAAgAAAAFABIBAwABAAAAAQAAADEBAgAcAAAASgAAADIBAgAUAAAAZgAA ABMCAwABAAAAAQAAAGmHBAABAAAAegAAAAAAAABBQ0QgU3lzdGVtcyBEaWdpdGFsIEltYWdpbmcA MjAwNDoxMDowMSAxODoyNTowMAAFAACQBwAEAAAAMDIxMJCSAgAEAAAANjE4AAKgBAABAAAAIAMA > </file> > </attachment> > That will be another problem: you need to transform that to fit in a "document" element as mentioned in my first email. Eric -- Curious about Relax NG? Read my book online. http://books.xmlschemata.org/relaxng/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Taras Bahnyuk
I'm using the latest stable release, which is 2.8 :-)
-----Original Message----- From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: woensdag 4 januari 2006 19:18 To: [hidden email] Subject: Re: [ops-users] Base64 decoder What version of OPS are you using? -Erik -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Eric van der Vlist
Eric van der Vlist wrote:
> Seems pretty conform to the doc :) > > http://www.orbeon.com/ops/doc/processors-serializers#d1102965e84 says: > > "The content-type element is optional. The default is application/xml. > Other valid values are text/html and text/plain." > > and you're giving it "image/jpg"... > > That would work with the HTTP serializer but not with the file > serializer :-( ! behave like the HTTP serializer, which is why I was asking the question about the version of OPS used. -Erik -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Taras Bahnyuk
In this case, you cannot use the File serializer to serialize binary
content. You are lucky because we did produce a patch for this at some point! Try putting the attached JAR in your WEB-INF/lib and it should work. -Erik Taras Bahnyuk wrote: > I'm using the latest stable release, which is 2.8 :-) > > > -----Original Message----- > From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez > Sent: woensdag 4 januari 2006 19:18 > To: [hidden email] > Subject: Re: [ops-users] Base64 decoder > > What version of OPS are you using? > > -Erik ops-2.8-file_serializer_patch.jar (60K) Download Attachment |
In reply to this post by Taras Bahnyuk
Another good reason to upgrade, I wish I could use betas here.
Thanks for helping me guys :-) -Taras -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: woensdag 4 januari 2006 19:26 To: [hidden email] Subject: Re: [ops-users] Base64 decoder Eric van der Vlist wrote: > Seems pretty conform to the doc :) > > http://www.orbeon.com/ops/doc/processors-serializers#d1102965e84 says: > > "The content-type element is optional. The default is application/xml. > Other valid values are text/html and text/plain." > > and you're giving it "image/jpg"... > > That would work with the HTTP serializer but not with the file > serializer :-( ! behave like the HTTP serializer, which is why I was asking the question about the version of OPS used. -Erik -- The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |