Hi Kerstin, Sorry for the slow reply.
It looks like your code is calling loader.getAllLoaded() to get the array of schemas and then serializing them all, concatenated, into a single string. So far so good. But on the receiving end, you are reading in this string and parsing only the first schema from it. What you need to do is go through the list and load all of the schemas, not just the first one. If you use FlatArrayMessageReader to read each one, you can call its `getEnd()` method to find out where the first message ended, which tells you where the next message starts. Loop through all the schemas to load them, then look up the schema for AddressBook (you'll probably have to look it up by type ID rather than name) and use that to initialize the Dynamic API. Let me know if that helps. -Kenton On Tue, Sep 4, 2018 at 9:01 AM Kerstin Keller <kerstin.s.kel...@gmail.com> wrote: > Hi everyone, > > I have been successful in saving the Schema to a std::string, and parsing > it back to a schema. > But it seems to be incorrect, since I can't parse the actual data later on. > > I have created a standalone example to serialize both an AddressBook > message and an AddressBook Schema into a std::string, then recreate first > the schema from the std::string and use that schema to create a dynamic > message of the original AddressBook message. The sample compiles with both > VS 2015 and GCC 5.4 (of course, capnproto needs to be installed). > > Using > > capnp::SchemaLoader loader; > loader.loadCompiledTypeAndDependencies<AddressBook>(); > auto schemas = loader.getAllLoaded(); > > creates an array of schemas, of which the first one is the schema for > `People`, not for `AddressBook`. > Using these to parse my data later on, produces a runtime exception. > If instead I am using only > > auto schema = capnp::Schema::from<AddressBook>(); > > I can iterate over my data, but it will show the AddressBook as a list > with two entries, but not information about the list content is available. > > Running the sample will produce the exception. I highly appreciate if > someone could take a quick look at the code. > > -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to capnproto+unsubscr...@googlegroups.com. > Visit this group at https://groups.google.com/group/capnproto. > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/capnproto.