[protobuf] Re: How to parse a message with extensions?

2012-05-01 Thread Tim Edwards
You cannot use the extension's number as the key (though I agree, that
would be nice).  Instead, you need to provide the fully-qualified path
to the extended field inside square braces, e.g. [My.Extension.foo]:
'foovalue'.  Take a look at the Debug() output of an extended message
and you'll see this syntax expressed.

Regards,
_Tim

On Apr 26, 2:41 pm, Arkadiy vertl...@gmail.com wrote:
 I was not accurate in describing this.  I am using:

 TextFormat::PrintToString and
 TextFormat::ParseFromString.

 I assumed one should be able to parse what another generates.  But
 apparently this is not true for extensions.

 Still need help.

 Thanks,
 Arkadiy

 On Apr 26, 10:49 am, Arkadiy vertl...@gmail.com wrote:







  Hi all.

  I have a message with extension, and when I serialize it with
  SerializeToString(), the extension looks something like this:

  1000 {
    1: 1

  }

  However if I try to parse the resulting string with ParseFromString(),
  it complains about the line 1000 {:

  Error parsing text-format ... : 22:1: Expected identifier.

  So, looks like ParseFromString() requires a different format than
  SerializeToString() produces?

  Can anybody shed some light on it?

  Thanks for any help,

  Arkadiy

-- 
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.



[protobuf] Re: How to parse a message with extensions?

2012-04-26 Thread Arkadiy
I was not accurate in describing this.  I am using:

TextFormat::PrintToString and
TextFormat::ParseFromString.

I assumed one should be able to parse what another generates.  But
apparently this is not true for extensions.

Still need help.

Thanks,
Arkadiy

On Apr 26, 10:49 am, Arkadiy vertl...@gmail.com wrote:
 Hi all.

 I have a message with extension, and when I serialize it with
 SerializeToString(), the extension looks something like this:

 1000 {
   1: 1

 }

 However if I try to parse the resulting string with ParseFromString(),
 it complains about the line 1000 {:

 Error parsing text-format ... : 22:1: Expected identifier.

 So, looks like ParseFromString() requires a different format than
 SerializeToString() produces?

 Can anybody shed some light on it?

 Thanks for any help,

 Arkadiy

-- 
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.