Thanks Marc Gravell and Lars Schouw response on this issue.
 
Seems the corresponding XML serialization library isn't available for managed 
C++, so is it impossible to convert a protobuf object to XML so far.
 
I don't know whether google has a plan to write such plug-in and provide method 
ToXML()  then it will be very good.


At 2011-06-25 04:12:40,"Marc Gravell" <marc.grav...@gmail.com> wrote:

The code shown uses XmlSerializer - it doesn't use protobuf-net at all. 
protobuf-net does tend to be friendly towards this, however you would:


- deserialize with protobuf-net into objects
- serialize with XmlSerializer


The only point of co tact between the two is the object model in the middle.

On 24 Jun 2011, at 16:29, Lars Schouw <sch...@gmail.com> wrote:


Yes, for example in C# you can do like this to create an XPathDocument using 
the protobuf-net lib.


public static XPathDocument Serialize(ProtocolBufferMesage msg)
        {
            XPathDocument xmlDoc = null;
            Serializer.PrepareSerializer<Test>();


            XmlSerializer x = new XmlSerializer(msg.GetType());
            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (TextWriter w = new StreamWriter(memoryStream))
                {
                    x.Serialize(w, msg);
                    memoryStream.Position = 0;
                    xmlDoc = new XPathDocument(memoryStream);c
                }
            }
            return xmlDoc;
        } 

--
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web 
visithttps://groups.google.com/d/msg/protobuf/-/E_KNwOPbenoJ.
To post to this group, send email toproto...@googlegroups.com.
To unsubscribe from this group, send email 
toprotobuf+unsubscr...@googlegroups.com.
For more options, visit this group 
athttp://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 toproto...@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.

Reply via email to