> any Message* intoXML. Thanks to the reflection interface and
> TextFormat, it was pretty straightforward. (if there's interest in
> seeing it let me know... I'll clear it with my boss and post to this
> forum).
>
> Now I'm trying to do the reverse, and I'm having issues with repeated
> fields that are themselves messages. When parsing theXMLit finds a
> repeated message, but I can't figure out what method to call in order
> to automagically create a new object of the correct derived Message
> type for this repeated field. The goal is to call
> Reflection::AddMessage(), then recursively call my XmlToProto()
> routine on this new object, parsing any children in theXMLtree.
>
> I was looking for a method in either the Descriptor or Reflection
> interfaces to allocate a new object of the right Message-derived type
> (obviously it would have to then return it a a Message*, which is
> fine), but didn't see anything. Can someone point me in the right
> direction?
>
> Thanks in advance,
> -Jason
>
> On Sep 29, 6:06 am, sim <
simon.we...@gmail.com> wrote:
>
> > Cool. New syntax I didn't know about! I think this would be useful
> > for converting the other way around (Proto-to-XML).
>
> > On Sep 28, 6:05 pm, Kenton Varda <
ken...@google.com> wrote:
>
> > > Interesting.
>
> > > Another way to do this would be to write code based on protobuf reflection
> > > and custom options, so you could have aprotolike:
> > > message Foo {
> > > optional int32 i = 1 [(xml_disposition) = ATTRIBUTE];
> > > optional Bar bar = 2 [(xml_disposition) = ELEMENT];
> > > }
>
> > > On Mon, Sep 28, 2009 at 6:14 AM, sim <
simon.we...@gmail.com> wrote:
>
> > > > Hi all. Would anybody be interested in anXMLto Protocol Buffers