[xsd-users] naming issue w/serialization and parsing

Rizzuto, Raymond Raymond.Rizzuto at sig.com
Mon Jun 30 17:32:24 EDT 2008


Hi!

I'm generating serialization functions for my schema, and having some naming issues.  For classes that are lowercase (header, message, etc) the output serialization function names are getting an underscore appended:

    void
    message_ (::std::ostream& os,
              const ::sdmp::messages::message& x,
              const ::xml_schema::namespace_infomap& m,
              const ::std::string& e = "UTF-8",
              ::xml_schema::flags f = 0);

Classes that are upper case (Instrument, etc) have a serialize function that is a lower case version of the class name:

    void
    instrument (::std::ostream& os,
                const ::sdmp::messages::Instrument& x,
                const ::xml_schema::namespace_infomap& m,
                const ::std::string& e = "UTF-8",
                ::xml_schema::flags f = 0);

I'm guessing the that the message_ name was created to prevent the name from looking like a constructor.   Since this is a bit confusing, I'd rather have the serialize name be something like Class_serialize.

I was able to almost get the behavior I wanted with --serializer-regex /(.+)/$1_serialize/ - the problem is that Instrument's serialization becomes instrument_serialize.  This is what the trace says:

serialization function name: 'instrument'
try: '(.+)' : 'instrument_serialize' : +

I'm guessing that the function naming style is coming in to play here, though I am not sure.   Can you suggest what I can do so the serialize function name maintains the capitalization of the element being serialized?  I.e. so Instrument's serialization function would be Instrument_serialize?

On a related issue, I have elements in the schema that differ only in the case of the first letter (OrderInstruction and orderInstruction).  orderInstruction is actually derived from OrderInstruction.  The problem is I only see serialization functions for orderInstruction:

    void
    orderInstruction_serialize (::std::ostream& os,
                                const ::sdmp::messages::orderInstruction& x,
                                const ::xml_schema::namespace_infomap& m,
                                const ::std::string& e = "UTF-8",
                                ::xml_schema::flags f = 0);

There is no serialize function that takes a ::sdmp::messages::OrderInstruction.

Ray


________________________________
Ray Rizzuto
raymond.rizzuto at sig.com
Susquehanna International Group
(610)747-2336 (W)
(215)776-3780 (C)



________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.



More information about the xsd-users mailing list