Re: [protobuf] protocol buffer message to and from an XPathDocument
https://github.com/sijuv/protobuf-codec/ supports protobuf-xml conversions. On Thu, Jul 21, 2011 at 4:48 AM, lasse l...@schouw.me wrote: I want to use XPath on my messages so need to move to and from XML. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To view this discussion on the web visit https://groups.google.com/d/msg/protobuf/-/mKbJ7GITXV0J. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Support for protobuf along with xml and json
There is no straight forward way since there is no protobuf-jaxb binding. json works because of the json-jaxb binding provided by the container. You can easily get protobuf/json/xml working by adding the Providers for the same which use a protobuf-xml-protobuf /protobuf-json-protobuf converter and thus work with all the 3 mime-types without having alternate flows. Let me know in case you need example code. You can use https://github.com/sijuv/protobuf-codec to do the necessary conversions. On Wed, Jan 5, 2011 at 3:16 PM, Meghana meghana.vishwan...@gmail.comwrote: Hi, I was wondering if there is a way to accomodate for both protobuf and xml and json when using protocol buffers with the Jersey's REST framework. I tried using the protobuf-java-format (http://code.google.com/p/ protobuf-java-format) which accomodates both use of xml, etc. along with protobuf. The problem though is that Proto's MessageBodyReader/ Writer need to support the other MIME types (xml, json) as well. This seems unnecessary considering Jersey has this build into the framework already. If there is some straight forward way of achieving the same, I would be very interested in knowing about it. Thanks. Meghana. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] Re: Converting JSON Text Into PB Bytes Type
You could use https://github.com/sijuv/protobuf-codec . You can check the test case at https://github.com/sijuv/protobuf-codec/blob/master/protobuf-codec-json/src/test/java/protobuf/codec/json/JsonCodecTest.javafor usage. This library is listed under the google protobuf ThirdPartyAddOns wiki as Another JSON encoder/decoder for Javahttps://github.com/sijuv/protobuf-codec. Let me know if you run into any issues. Regards. On Wed, Dec 29, 2010 at 4:34 AM, Kenton Varda ken...@google.com wrote: You should probably contact the authors of protobuf-java-format; I'm not sure if they pay attention to this list. Base64 is the best way to encode arbitrary (non-text) data as text. However, it's really up to the JSON converter code you are using to decide what format to use. As far as I know, JSON does not specify any particular encoding for arbitrary bytes. On Sat, Dec 25, 2010 at 2:40 AM, yalmasri y.alma...@gmail.com wrote: Thanks for the reply. I encoded Hello world in Base64 and I got this SGVsbG8gd29ybGQ=. That doesn't look close to the format I sent in the question. Here's the code snippet I used: import org.apache.commons.codec.binary.Base64; public class Codec { public static void main(String[] args) { try { String clearText = Hello world; // Base64 System.out.println(Encoded: + Base64.encodeBase64String(clearText.getBytes())); } catch (Exception e) { e.printStackTrace(); } } } I'm using this: http://code.google.com/p/protobuf-java-format/ for JSON -- PB conversion On Dec 23, 3:48 am, Kenton Varda ken...@google.com wrote: You will probably need to base64-encode bytes fields before embedding them in JSON, since JSON is a text format. Which JSON - protobuf converter are you using? Or did you write your own? On Tue, Dec 21, 2010 at 11:41 PM, yalmasri y.alma...@gmail.com wrote: Hello, One of our customers is still using legacy Java 1.4 and therefore could not use PB. For that we created an intermediate service that receives text messages in plain JSON format then convert them into generated PB objects. In one object we have a field named desc of type bytes which will hold a textual description of the arriving message. When the customer wants to send English text for desc the value in JSON will be plain readable English, but if non-ASCII is to be used, how the value in JSON will look like? It look to me something like: \0069\0062\006J\0062\006J\000 \006\'\006D\0069\006E\006J\006D\006\f \000 \006D\006B\006/\000 \006\'\006F\006*\006G\006I\000 But I really don't know how to get this out of non-ASCII characters. Can anyone help? -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com protobuf%2bunsubscr...@googlegroups.comprotobuf%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] protobuf json codec
Hi Kenton, Thanks. I have removed com.google from the package declaration. Also I have added the following features : 1) XMLCodec : Relies on stax (woodstox) for parsing the xml 2) Faithfully propagate unknown fields in json/xml. Details are there on the project twiki at https://github.com/sijuv/protobuf-codec/wiki . Could you also update project link under http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns to indicate the support for xml too. Would be great to hear the feedback from the community. Regards, Siju On Wed, Dec 8, 2010 at 8:43 AM, Kenton Varda ken...@google.com wrote: Hi Siju, This is pretty cool. I added it to the third-party add-ons wiki. http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns Just a minor complaint: You are not Google, so your code should not live under the com.google package. Can you please move it to a different package? Perhaps com.github.sijuv would be appropriate? On Wed, Dec 1, 2010 at 9:11 PM, Siju varghese.s...@gmail.com wrote: I have written a json codec for protobuf which uses jackson as the underlying parsing framework. It is twice as fast for json-protobuf conversion compared to the json codec at http://code.google.com/p/protobuf-java-format/ and about the same for protobuf-json conversion. This is the first draft, and I plan to plugin other serialization schemes like xml. Appreciate feedback from the community. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
Re: [protobuf] protobuf json codec
Missed out the link the source code. Please find the codec I wrote at https://github.com/sijuv/protobuf-codec On Thu, Dec 2, 2010 at 10:41 AM, Siju varghese.s...@gmail.com wrote: I have written a json codec for protobuf which uses jackson as the underlying parsing framework. It is twice as fast for json-protobuf conversion compared to the json codec at http://code.google.com/p/protobuf-java-format/ and about the same for protobuf-json conversion. This is the first draft, and I plan to plugin other serialization schemes like xml. Appreciate feedback from the community. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.