From boris at codesynthesis.com Tue Jul 1 02:02:45 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] xsd problem In-Reply-To: <175338300806300933w11c3b369t4108dc29a1b7f7eb@mail.gmail.com> References: <175338300806300933w11c3b369t4108dc29a1b7f7eb@mail.gmail.com> Message-ID: <20080701060245.GA31475@karelia> Hi Paras, PARAS BHATEJA writes: > we have to generate simple code instead of your code. i want that the > classes generated should be simple and to the point as there are java > classes generated through JAXB marshalling and unmarshalling Java is different from C++ so it shouldn't be surprising that the XML Schema mappings are different as well. For example for an element with maxOccurs="unbounded" JAXB would return a type-less java.util.List. This is not how it is done in C++. In XSD we return a statically-typed container template. To make this convenient to use we provide a typedef for this container along with accessor and modifier functions which, on the surface, may seem more complicated that JABX (your code will be a lot cleaner and safer without the the type casts, though). Overall, we tried to make the mapping as simple to use as possible while being able to handle non-trivial, real-world schemas. We don't have a simpler mapping for you. Therefore you have two options: 1. Look if someone else offers a mapping that satisfies your requirements. 2. Get to understand why things are done the way they are done in XSD. To get started, I suggest that you read through the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ If you are in a hurry, at least read chapters 2 ("Hello World Example") and 4 ("Working with Object Models"). Boris From boris at codesynthesis.com Tue Jul 1 09:51:58 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] naming issue w/serialization and parsing In-Reply-To: References: Message-ID: <20080701135158.GF32105@karelia> Hi Ray, Rizzuto, Raymond writes: > For classes that are lowercase (header, message, etc) the output > serialization function names are getting an underscore appended: > > message_ (::std::ostream& os, > > [...] > > Classes that are upper case (Instrument, etc) have a serialize > function that is a lower case version of the class name: > > instrument (::std::ostream& os, Serialization (and parsing) functions are generated for global elements, not for types. This is to match the XML Schema concept that only global elements are valid document roots. The underscore is appended to the parsing/serialization functions if there is a type with the same name (note that if a global element defines an anonymous type, this type will have the same name as the element and parsing/serialization functions will have '_'; you can change this with the --anonymous-regex option). > Since this is a bit confusing, I'd rather have the serialize name be > something like Class_serialize. As explained above, you can only make it _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. I guess you have a type named Instrument and a global element named instrument. If this naming style is used consistently in your schema then you can get the desired behavior by uppercasing the first latter: --serializer-regex /(.+)/\u$1_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: This is probably because you have a global element for orderInstruction and not for OrderInstruction. Also note that you can serialize any type using serialization operators. This requires a bit of extra work but it can be done, for example: OrderInstruction& oi = ... DOMDocument* doc = ... // create a DOM document, see FAQ 3.1 DOMElement* root = doc->getDocumentElement (); *root << oi; // Serialize doc to XML, see FAQ 3.2 Boris From ap at kaon.co.uk Tue Jul 1 12:05:46 2008 From: ap at kaon.co.uk (Alan Pettitt) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] duration Message-ID: <1214928346.3136.5.camel@jabberwock> I am using xsd v3.1.0. I generate a duration in XML say 2 hours, which successfully gets converted to "PT2H" by xsd. However, when parsing all the fields which are not used are set to illegal values - only the hours field is valid, the others, which I would expect to be zero, contain random, uninitialised values. Everything else I have tried appears to works brilliantly! From Raymond.Rizzuto at sig.com Tue Jul 1 17:59:56 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] naming issue w/serialization and parsing References: <20080701135158.GF32105@karelia> Message-ID: I ended up with this command line, which gives me what I was looking for: xsd.exe cxx-tree --output-dir . --hxx-suffix .hxx --cxx-suffix .cxx --ixx-suffix .ixx --fwd-suffix -fwd.hxx --generate-serialization --generate-polymorphic --generate-ostream --generate-doxygen --generate-comparison --generate-from-base-ctor --generate-wildcard --generate-intellisense --root-element-all --anonymous-regex "|.* .* (.+/)*(.+)|$2|" --serializer-regex "/(.+)/serialize_$1/" --parser-regex "/(.+)/parse_$1/" --modifier-regex "/(.+)/set_$1/" --accessor-regex "/(.+)/get_$1/" Ray -----Original Message----- From: Rizzuto, Raymond Sent: Tuesday, July 01, 2008 4:16 PM To: 'Boris Kolpackov' Subject: RE: [xsd-users] naming issue w/serialization and parsing Boris, Thanks for the detailed answers. I think part of the problem I have is in understanding the mapping from the schema to the object model that XSD generates. I'm new to schema, and the fact that XSD insulates me from the schema is a double edged sword. I think I can use the various regex's you provide to generate the names the way I want them. I basically would like to use knr style (i.e. underscore separators, but no case conversion), however I want the accessor functions to prepend get_, and the modifiers to prepend set_, serializer prepend serialize_, etc. I'm sure I can figure this out over time, however I have a couple of suggestions that might make this kind of customization easier: - possibly allow finer granularity to specify the style. I.e. --accessor-type java - document the entire set of base regex's for knr, java, etc. to make it easier to create a mix and match version - allow a style to be defined in a file and referenced. i.e. --load-style myStyle.def. This would also help with corporate coding conventions. Anyway, I am forging ahead with some success. Thanks again! Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, July 01, 2008 9:52 AM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] naming issue w/serialization and parsing Hi Ray, Rizzuto, Raymond writes: > For classes that are lowercase (header, message, etc) the output > serialization function names are getting an underscore appended: > > message_ (::std::ostream& os, > > [...] > > Classes that are upper case (Instrument, etc) have a serialize > function that is a lower case version of the class name: > > instrument (::std::ostream& os, Serialization (and parsing) functions are generated for global elements, not for types. This is to match the XML Schema concept that only global elements are valid document roots. The underscore is appended to the parsing/serialization functions if there is a type with the same name (note that if a global element defines an anonymous type, this type will have the same name as the element and parsing/serialization functions will have '_'; you can change this with the --anonymous-regex option). > Since this is a bit confusing, I'd rather have the serialize name be > something like Class_serialize. As explained above, you can only make it _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. I guess you have a type named Instrument and a global element named instrument. If this naming style is used consistently in your schema then you can get the desired behavior by uppercasing the first latter: --serializer-regex /(.+)/\u$1_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: This is probably because you have a global element for orderInstruction and not for OrderInstruction. Also note that you can serialize any type using serialization operators. This requires a bit of extra work but it can be done, for example: OrderInstruction& oi = ... DOMDocument* doc = ... // create a DOM document, see FAQ 3.1 DOMElement* root = doc->getDocumentElement (); *root << oi; // Serialize doc to XML, see FAQ 3.2 Boris 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. From Raymond.Rizzuto at sig.com Tue Jul 1 18:12:45 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any Message-ID: Hi! I have been getting (and ignoring) errors like these: 1>SDMP-1.2.xsd:738:90: warning: namespace '##any' allows for element 'ticket' 1>SDMP-1.2.xsd:738:90: warning: generated code may not associate element 'ticket' correctly if it appears in place of this wildcard 1>SDMP-1.2.xsd:601:46: info: element 'ticket' is defined here 1>SDMP-1.2.xsd:738:90: warning: namespace '##any' allows for element 'price' 1>SDMP-1.2.xsd:738:90: warning: generated code may not associate element 'price' correctly if it appears in place of this wildcard 1>SDMP-1.2.xsd:602:44: info: element 'price' is defined here The errors occur with this definition: The price the order originator is willing to pay (or accept) if it is a number. . . . Additional elements may be added in future revisions. Is there something I can do to eliminate the reason for the warning? Ray ________________________________ Ray Rizzuto raymond.rizzuto@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. From boris at codesynthesis.com Wed Jul 2 04:44:08 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] duration In-Reply-To: <1214928346.3136.5.camel@jabberwock> References: <1214928346.3136.5.camel@jabberwock> Message-ID: <20080702084408.GA2977@karelia> Hi Alan, Alan Pettitt writes: > I am using xsd v3.1.0. I generate a duration in XML say 2 hours, which > successfully gets converted to "PT2H" by xsd. However, when parsing all > the fields which are not used are set to illegal values - only the hours > field is valid, the others, which I would expect to be zero, contain > random, uninitialised values. That's a bug which I've fixed for the next release. You can also fix it in 3.1.0 by replacing parsing/date-time.txx with the one provided in this archive: http://www.codesynthesis.com/~boris/tmp/xsd-3.1.0-duration.tar.gz Thanks for reporting this! Boris From boris at codesynthesis.com Wed Jul 2 04:50:19 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] Re: Turkish Character Problem In-Reply-To: <7f05c8080807020029g251e1c28j7f2f7ef773ceae47@mail.gmail.com> References: <7f05c8080807020029g251e1c28j7f2f7ef773ceae47@mail.gmail.com> Message-ID: <20080702085019.GB2977@karelia> Hi Ebubekir, In the future please send technical questions like these to the xsd-users mailing list (which I've CC'ed) instead of to the general information address. This way other developers who may have experienced a similar problem can provide you with a solution. Plus questions and answers will be archived and available to others with similar problems. ebubekir temizkan writes: > Hi, I am Ebubekir, I work in a noncommercial Project. I want to use code > synthesis Xml tree Library .I installed and I started to parse xml but > there is an important problem. I can not use turkish character problem in > xml data . > > Kir??? like this data > > Compiler error... You will need to be more specific about where you are trying to use Turkish characters (is it XML or C++ source code?) as well as which compiler error you get. You may also find the answer to Q 1.2, "What character encoding does the generated code use?" in the C++/Tree Mapping FAQ useful: http://wiki.codesynthesis.com/Tree/FAQ Boris From boris at codesynthesis.com Wed Jul 2 09:56:12 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] naming issue w/serialization and parsing In-Reply-To: References: <20080701135158.GF32105@karelia> Message-ID: <20080702135612.GB15505@karelia> Hi Ray, Rizzuto, Raymond writes: > Thanks for the detailed answers. I think part of the problem I have is > in understanding the mapping from the schema to the object model that > XSD generates. This is documented in detail in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ > - possibly allow finer granularity to specify the style. I.e. > --accessor-type java Our general philosophy in matters like this is to provide an easy to use, high-level mechanism for commonly used cases as well as the powerful, low-level one for situations where people want to do their own thing. Providing mechanisms in between these two extremes is generally not worth the effort since only a handful of people will ever use them. > - document the entire set of base regex's for knr, java, etc. to make it > easier to create a mix and match version We thought about this but decided against it since it would take up way too much space. You can always find the exact expressions in the source code (see xsd/cxx/tree/name-processor.cxx). > - allow a style to be defined in a file and referenced. i.e. > --load-style myStyle.def. This would also help with corporate coding > conventions. You can already do this using the more generic mechanism offered by the --options-file option. Boris From boris at codesynthesis.com Wed Jul 2 10:33:42 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: References: Message-ID: <20080702143342.GC15505@karelia> Hi Ray, Rizzuto, Raymond writes: > 1>SDMP-1.2.xsd:738:90: warning: namespace '##any' allows for element 'ticket' > 1>SDMP-1.2.xsd:738:90: warning: generated code may not associate element > 'ticket' correctly if it appears in place of this wildcard > 1>SDMP-1.2.xsd:601:46: info: element 'ticket' is defined here > > [...] > > > > > > The special ##any namespace indicates that an element from any namespace, including the schema's target namespace, can appear. As a result, in order to support this widlcard in the general case, one needs to perform full-blown structure validation in order to determine which elements are matched by which schema declaration. In the C++/Tree mapping we delegate the XML Schema validation to the underlying XML parser (Xerces-C++) and thus, in certain situations, cannot guarantee correct association of content. For example, an element with name 'ticket' can appear for the wildcard which may cause the current parsing code to fail to associate this element properly (e.g., it will be associated to the 'ticket' element instead of the wildcard) That's why the XSD compiler detects such cases and issues warnings. It is rarely the intention of the schema author to allow elements from the same schema (let alone the same type) to appear in the wildcard. If the 'ticket' and 'price' elements can never appear in the content matched by the wildcard then you can safely ignore this warning. If none of the elements from the schema's target namespace are supposed to appear in the content matched by the wildcard, then you can go a step further and replace ##any with ##other which will get rid of the warning. Boris From Raymond.Rizzuto at sig.com Wed Jul 2 11:10:30 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: <20080702143342.GC15505@karelia> References: <20080702143342.GC15505@karelia> Message-ID: Boris, I can see where the ambiguity would occur in certain cases, such as with optional or sets, but for a sequence of A, B, ##ANY, where A and B must appear exactly 1 time, an A or B in the ##ANY slot shouldn't be ambiguous. Does the warning occur for ##ANY, regardless of that? I.e. the warning is not taking the context into consideration, just telling the author to be advised? Since I am not the schema author, I can't really make changes, but I'll raise the question with the author. I believe he has the ##ANY in so that a future version of the protocol will be compatible with the current version. I.e. a 1.3 version with a new field added at the end of the sequence will still talk to the 1.2 version I am coding. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, July 02, 2008 10:34 AM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] warning with any Hi Ray, Rizzuto, Raymond writes: > 1>SDMP-1.2.xsd:738:90: warning: namespace '##any' allows for element 'ticket' > 1>SDMP-1.2.xsd:738:90: warning: generated code may not associate element > 'ticket' correctly if it appears in place of this wildcard > 1>SDMP-1.2.xsd:601:46: info: element 'ticket' is defined here > > [...] > > > > > > The special ##any namespace indicates that an element from any namespace, including the schema's target namespace, can appear. As a result, in order to support this widlcard in the general case, one needs to perform full-blown structure validation in order to determine which elements are matched by which schema declaration. In the C++/Tree mapping we delegate the XML Schema validation to the underlying XML parser (Xerces-C++) and thus, in certain situations, cannot guarantee correct association of content. For example, an element with name 'ticket' can appear for the wildcard which may cause the current parsing code to fail to associate this element properly (e.g., it will be associated to the 'ticket' element instead of the wildcard) That's why the XSD compiler detects such cases and issues warnings. It is rarely the intention of the schema author to allow elements from the same schema (let alone the same type) to appear in the wildcard. If the 'ticket' and 'price' elements can never appear in the content matched by the wildcard then you can safely ignore this warning. If none of the elements from the schema's target namespace are supposed to appear in the content matched by the wildcard, then you can go a step further and replace ##any with ##other which will get rid of the warning. Boris 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. From boris at codesynthesis.com Wed Jul 2 11:57:00 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: References: <20080702143342.GC15505@karelia> Message-ID: <20080702155700.GC3804@karelia> Hi Ray, Rizzuto, Raymond writes: > I can see where the ambiguity would occur in certain cases, such as with > optional or sets, but for a sequence of A, B, ##ANY, where A and B must > appear exactly 1 time, an A or B in the ##ANY slot shouldn't be > ambiguous. It is not in the XML Schema sense. It is, however, in the case of the XSD-generated parsing code. Since XML Schema validation is performed in the underlying XML parser we try to make the parsing code as small as possible. As a result, it is a simple loop that iterates over elements and tries to match them in order of appearance. In your original example, you have an optional element 'ticket' followed by required element 'price' which is following by the wildcard. In the content like this: The 'ticket' element should be matched by the wildcard but the generated parsing code will match it to the 'ticket' element which is missing in the content. In this particular situation the loop-based approach does not appear to be simpler than the alternative that would parser each element at a time and then move to the next one. Things, however, get more complex once you need to handle nested choice/sequence compositors. > Does the warning occur for ##ANY, regardless of that? I.e. the warning > is not taking the context into consideration, just telling the author to > be advised? No, the compiler only issues the warning when the mis-match can actually occur. > Since I am not the schema author, I can't really make changes, but I'll > raise the question with the author. I believe he has the ##ANY in so > that a future version of the protocol will be compatible with the > current version. I.e. a 1.3 version with a new field added at the end > of the sequence will still talk to the 1.2 version I am coding. In this case I would assume that the 'ticket' and 'price' elements cannot appear in place of the wildcard in version 1.3 and thus the warning can be safely ignored (this is probably the case in 99.9% of the situations this warning is issued). Boris From Raymond.Rizzuto at sig.com Wed Jul 2 12:28:44 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: <20080702155700.GC3804@karelia> References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> Message-ID: Boris, I played around with ##any with the cxx-parser, and see that I get a similar error: xsd.exe cxx-parser simple.xsd simple.xsd:39:88: warning: namespace '##any' allows for element 'diary' simple.xsd:39:88: warning: generated code may not associate element 'diary' correctly if it appears in place of this wildcard simple.xsd:38:29: info: element 'diary' is defined here simple.xsd:39:88: info: turn on validation to ensure correct association However, no error is generated with either of these command lines: xsd.exe cxx-parser --xml-parser expat simple.xsd xsd.exe cxx-parser --generate-validation simple.xsd I don't know if there is sufficient demand for it, but having an option (like --generate-validation for the cxx-tree) to generate a "perfect" parser would address this case, albeit probably with a performance hit. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, July 02, 2008 11:57 AM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] warning with any Hi Ray, Rizzuto, Raymond writes: > I can see where the ambiguity would occur in certain cases, such as with > optional or sets, but for a sequence of A, B, ##ANY, where A and B must > appear exactly 1 time, an A or B in the ##ANY slot shouldn't be > ambiguous. It is not in the XML Schema sense. It is, however, in the case of the XSD-generated parsing code. Since XML Schema validation is performed in the underlying XML parser we try to make the parsing code as small as possible. As a result, it is a simple loop that iterates over elements and tries to match them in order of appearance. In your original example, you have an optional element 'ticket' followed by required element 'price' which is following by the wildcard. In the content like this: The 'ticket' element should be matched by the wildcard but the generated parsing code will match it to the 'ticket' element which is missing in the content. In this particular situation the loop-based approach does not appear to be simpler than the alternative that would parser each element at a time and then move to the next one. Things, however, get more complex once you need to handle nested choice/sequence compositors. > Does the warning occur for ##ANY, regardless of that? I.e. the warning > is not taking the context into consideration, just telling the author to > be advised? No, the compiler only issues the warning when the mis-match can actually occur. > Since I am not the schema author, I can't really make changes, but I'll > raise the question with the author. I believe he has the ##ANY in so > that a future version of the protocol will be compatible with the > current version. I.e. a 1.3 version with a new field added at the end > of the sequence will still talk to the 1.2 version I am coding. In this case I would assume that the 'ticket' and 'price' elements cannot appear in place of the wildcard in version 1.3 and thus the warning can be safely ignored (this is probably the case in 99.9% of the situations this warning is issued). Boris 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. From Raymond.Rizzuto at sig.com Wed Jul 2 15:00:54 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] comparison question In-Reply-To: <20080701133702.GE32105@karelia> References: <20080627081327.GD9497@karelia> <20080630164108.GA29494@karelia> <20080630203501.GF29494@karelia> <20080701133702.GE32105@karelia> Message-ID: Boris, I'm using the --generate-ostream option so I can print the objects I generate. Here is the XML for an object that I create in memory:
message-1
request-1
When I print it, this is what I get: header: containerId: message-1 source: SusexToSDMP source: hi messageType: version: 1.2 It looks like messageType is only printing the base class data, not the data in the derived newRequest class. I'm guessing this is the same issue as the comparison operator. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, July 01, 2008 9:37 AM To: Rizzuto, Raymond Cc: Boris Kolpackov Subject: Re: [xsd-users] comparison question Hi Ray, Rizzuto, Raymond writes: > Your approach sounds like it would work also. And it sound like it may > be simpler than the derived class idea. Is that something that might > make the next release? I'd be glad to try it out. Yes, I think we will implement it for the next release. Give me a couple of days and I will try to implement it and build you a pre- release binary to try. Boris 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. From boris at codesynthesis.com Wed Jul 2 15:26:33 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> Message-ID: <20080702192633.GE3804@karelia> Hi Ray, [CC'ed xsd-users] Rizzuto, Raymond writes: > Thanks for the response. I think I can live with that limitation. My > application is mostly generating messages, although there may be > interest here in using the same code elsewhere for parsing in the > future. I don't think it is really a limitation in your case. In all XML vocabularies that I have seen the wildcard is never meant to match the same elements as specified elsewhere in the type ('ticket' and 'price' in your case). We probably raise more questions than is warranted with this warning but we also don't want to hide any potential (however unlikely) problems from the user. I know I would prefer products that I rely on to do it this way. Boris From boris at codesynthesis.com Wed Jul 2 15:30:21 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> Message-ID: <20080702193021.GF3804@karelia> Hi Ray, Rizzuto, Raymond writes: > However, no error is generated with either of these command lines: > > xsd.exe cxx-parser --xml-parser expat simple.xsd > xsd.exe cxx-parser --generate-validation simple.xsd In this case we perform validation in the generated code and thus can always associate things correctly. > I don't know if there is sufficient demand for it, but having an option > (like --generate-validation for the cxx-tree) to generate a "perfect" > parser would address this case, albeit probably with a performance hit. It would also require a substantial effort to implement. We are currently working on another in-memory mapping similar to C++/Tree which will support XML Schema validation in the generated code. Boris From Raymond.Rizzuto at sig.com Wed Jul 2 15:50:19 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:04 2009 Subject: [xsd-users] warning with any In-Reply-To: <20080702193021.GF3804@karelia> References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> <20080702193021.GF3804@karelia> Message-ID: Boris, I think C++?Tree suffices for my requirements, but I may be interested in looking at the new mapping. Hopefully the generated interface is similar enough that it isn't a major recoding effort to switch down the road. Thanks again for your answers. XSD is a great product. I'm amazed at the level of documentation and capability in it. My comments and suggestions are inspired by its utility. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, July 02, 2008 3:30 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] warning with any Hi Ray, Rizzuto, Raymond writes: > However, no error is generated with either of these command lines: > > xsd.exe cxx-parser --xml-parser expat simple.xsd > xsd.exe cxx-parser --generate-validation simple.xsd In this case we perform validation in the generated code and thus can always associate things correctly. > I don't know if there is sufficient demand for it, but having an option > (like --generate-validation for the cxx-tree) to generate a "perfect" > parser would address this case, albeit probably with a performance hit. It would also require a substantial effort to implement. We are currently working on another in-memory mapping similar to C++/Tree which will support XML Schema validation in the generated code. Boris 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. From Raymond.Rizzuto at sig.com Mon Jul 7 09:03:19 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] warning with any In-Reply-To: <20080702193021.GF3804@karelia> References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> <20080702193021.GF3804@karelia> Message-ID: Would it be possible to have a command line option to suppress the warnings for ##any like these below: 1>SDMP.xsd:751:90: warning: namespace '##any' allows for element 'ticket' 1>SDMP.xsd:751:90: warning: generated code may not associate element 'ticket' correctly if it appears in place of this wildcard 1>SDMP.xsd:609:46: info: element 'ticket' is defined here The reason I ask is that I get ~240 warnings just from compiling the schema, which makes it hard to notice any warnings in the rest of the build. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, July 02, 2008 3:30 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] warning with any Hi Ray, Rizzuto, Raymond writes: > However, no error is generated with either of these command lines: > > xsd.exe cxx-parser --xml-parser expat simple.xsd > xsd.exe cxx-parser --generate-validation simple.xsd In this case we perform validation in the generated code and thus can always associate things correctly. > I don't know if there is sufficient demand for it, but having an option > (like --generate-validation for the cxx-tree) to generate a "perfect" > parser would address this case, albeit probably with a performance hit. It would also require a substantial effort to implement. We are currently working on another in-memory mapping similar to C++/Tree which will support XML Schema validation in the generated code. Boris 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. From Alex.Rosenbaum at thomsonreuters.com Mon Jul 7 13:38:02 2008 From: Alex.Rosenbaum at thomsonreuters.com (Alex Rosenbaum) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] help with xsd generation Message-ID: <9AA279A74D411E4BAF4FDA2A22CE1B2C5A0DC8@NYCSMSXM01.amers.ime.reuters.com> Dear xsd-users I am using CodeSynthesis xsd 3.1 with MS Visual Studio 8.0. I have followed all available advice to generate c++ code from the attached xsd file. The command line was: xsd.exe cxx-tree --generate-intellisense TibAppConfig.xsd The code generation is successfull. When I try to instantiate the generated classes from my xml (also attached) I am receiving errors as below. The code that fails looks like this: namespace Reuters_EcoWin_Falcon { void TestConfigurationAPI() { try { std::auto_ptr ta(Falcon_("c:/dev/SimpleRepublisher.xml")); } catch (const xml_schema::exception& e) { std::cerr << e << std::endl; } I will truly appreciate any help with it. Thank you Alex c:/dev/SimpleRepublisher.xml:4:63 error: Unknown element 'Falcon' c:/dev/SimpleRepublisher.xml:4:63 error: Attribute 'xmlns' is not declared for lement 'Falcon' c:/dev/SimpleRepublisher.xml:4:63 error: Attribute '{http://www.w3.org/2000/xml s/}xsi' is not declared for element 'Falcon' c:/dev/SimpleRepublisher.xml:6:11 error: Unknown element 'Common' c:/dev/SimpleRepublisher.xml:7:24 error: Unknown element 'TibAppEnvironment' c:/dev/SimpleRepublisher.xml:8:16 error: Unknown element 'service' c:/dev/SimpleRepublisher.xml:9:16 error: Unknown element 'network' c:/dev/SimpleRepublisher.xml:11:10 error: Unknown element 'daemon' c:/dev/SimpleRepublisher.xml:12:23 error: Unknown element 'subjectPrefix' http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:228:36 error: '\$' is not a valid character escape http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:154:62 error: SimpleType ( http://www.nlog-project.org/schemas/NLog.xsd:NLog ayout) for attribute: file not found http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:228:36 error: '\$' is not a valid character escape http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:171:63 error: SimpleType ( http://www.nlog-project.org/schemas/NLog.xsd:NLog ayout) for attribute: value not found http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:228:36 error: '\$' is not a valid character escape http://nycsrrur1/urreq/rrurreq.dll?xsd=http://www.nlog-project.org/schem as/NLog xsd:198:67 error: SimpleType ( http://www.nlog-project.org/schemas/NLog.xsd:NLog ayout) for attribute: layout not found Alex Rozenbaum Consultant Thomson Reuters Phone: 646-223-5230 alex.rosenbaum@thomsonreuters.com thomsonreuters.com -------------- next part -------------- A non-text attachment was scrubbed... Name: SimpleRepublisher.xml Type: text/xml Size: 3262 bytes Desc: SimpleRepublisher.xml Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080707/ca5305c8/SimpleRepublisher.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: TibAppConfig.xsd Type: application/octet-stream Size: 16680 bytes Desc: TibAppConfig.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080707/ca5305c8/TibAppConfig.obj From boris at codesynthesis.com Mon Jul 7 14:44:41 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] help with xsd generation In-Reply-To: <9AA279A74D411E4BAF4FDA2A22CE1B2C5A0DC8@NYCSMSXM01.amers.ime.reuters.com> References: <9AA279A74D411E4BAF4FDA2A22CE1B2C5A0DC8@NYCSMSXM01.amers.ime.reuters.com> Message-ID: <20080707184441.GD6440@karelia> Hi Alex, Alex Rosenbaum writes: > c:/dev/SimpleRepublisher.xml:4:63 error: Unknown element 'Falcon' These kind of errors almost invariably mean that the parser could not find the schema corresponding to your XML document. Because XML Schema validation is enabled by default you get all these errors. To fix this you can disable XML Schema validation or you can use several methods to specify schema locations as described in Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From boris at codesynthesis.com Mon Jul 7 16:45:00 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] warning with any In-Reply-To: References: <20080702143342.GC15505@karelia> <20080702155700.GC3804@karelia> <20080702193021.GF3804@karelia> Message-ID: <20080707204500.GE6440@karelia> Hi Ray, Rizzuto, Raymond writes: > Would it be possible to have a command line option to suppress the > warnings for ##any like these below: We have added the mechanism to suppress individual warning for the next release. Thanks for the suggestion. Boris From chenuang at gmail.com Wed Jul 9 13:14:48 2008 From: chenuang at gmail.com (Wang Chen) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Where can I find info about C++/Hybrid Message-ID: Hi, I'm a new user of the XSD tool. Some early experiment shows that the performance of parsing and serialization is slightly below expectation. Fortunately it is said that there will be a new 'C++/Hybrid' mapping available soon, which decouples the in-mem data binding with parser/serializer, and hopefully will address the performance issue. Where can I get more info about the 'Hybrid' mapping? Some prototype usage example will be much appreciated. Thanks From boris at codesynthesis.com Thu Jul 10 09:45:21 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Where can I find info about C++/Hybrid In-Reply-To: References: Message-ID: <20080710134521.GC24506@karelia> Hi Wang, Wang Chen writes: > Some early experiment shows that the performance of parsing and > serialization is slightly below expectation. I would be interested to know some more about your setup, what kind XML documents you are parsing, what performance you get and what is required. There is also a number of techniques that can be used to obtain better performance, including: * Disabling XML Schema validation if not required. * Pre-parsing and caching XML Schema which can then be reused to validate multiple documents. * Reusing XML parser/serializer to parse/serialize multiple documents. The last two techniques are demonstrated in the 'caching' example in examples/cxx/tree/. Furthermore, the next release of Xerces-C++, which should be out in the next couple of month with final beta available in the next couple of weeks, is currently about 20% faster than 2.8.0. This might also help. > Fortunately it is said that there will be a new 'C++/Hybrid' > mapping available soon, which decouples the in-mem data > binding with parser/serializer, and hopefully will address the > performance issue. Where can I get more info about the 'Hybrid' > mapping? Some prototype usage example will be much appreciated. We plan to first introduce this mapping in XSD/e, our embedded systems offering. After that it will be ported to XSD. We expect to get the first usable version in XSD/e by mid-October. For a high-level overview of the mapping please see: http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001727.html Boris From Raymond.Rizzuto at sig.com Mon Jul 14 12:30:33 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] parser issue Message-ID: Hi! I am creating a object and serializing it to XML with xsd-tree. This is the output:
SAX.48420080707.562559
SAX.48420080707.562559 SAX.48420080707.562559 Tplus3 SAX.48420080707.562559 4.61 100 0 SAX.484 SAX.484.0 SSCC
I then try to parse the XML back to an object to validate the round trip. However, I am getting these errors: :38:26 error: Element 'displayReserveQuantity' is not valid for content model: '(id,,(ticket,originatorLocate,price,contingentPrice,stopPrice,quantity,minQuantity,maxQuantity,((displayQuantity,displayRefreshQuantity),displayReserveQuantity),bookingUnitQuantity,(timeInForceActivationDateTime,timeInForceExpirationDateTime),efpText,rerouteOfOrderInstructionId,beneficiaryLegalEntity,netOrCommFormula,netOrCommAmount,originatorId,handlerId,originatorPublicId,handlerPublicId,directedExecutionVenue,directedOrderHandlingService,originatorDesignatedLegalEntity,originatorTradingPerson,originatorLegalEntity,handlerTradingPerson,handlerLegalEntity),)' :43:16 error: Element 'simpleOrder' is not valid for content model: '(request|order)' The first error looks like it is because I didn't fill in a mandatory element of an optional sequence contained within orderInstruction. Unfortunately, that case didn't get detected at compile/run time in the serialization flow, only during parsing. Here is the offending sequence: The second error appears to be complaining that the message contains a simpleOrder in the order "slot", yet I believe that is allowed by substitution group: Is that an xsd-tree bug or some issue with my code/schema? Ray ________________________________ Ray Rizzuto raymond.rizzuto@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. From Raymond.Rizzuto at sig.com Mon Jul 14 14:53:48 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] RE: parser issue Message-ID: My apologies! The first error is also a case of operator error on my part. The newRequest can have either a request or an order, but not both. I am a bit concerned that it was so easy to generate invalid output, however. Why didn't the serialize call throw an exception indicating this error? Ray ________________________________ From: Rizzuto, Raymond Sent: Monday, July 14, 2008 12:31 PM To: xsd-users@codesynthesis.com Subject: parser issue Hi! I am creating a object and serializing it to XML with xsd-tree. This is the output:
SAX.48420080707.562559
SAX.48420080707.562559 SAX.48420080707.562559 Tplus3 SAX.48420080707.562559 4.61 100 0 SAX.484 SAX.484.0 SSCC
I then try to parse the XML back to an object to validate the round trip. However, I am getting these errors: :38:26 error: Element 'displayReserveQuantity' is not valid for content model: '(id,,(ticket,originatorLocate,price,contingentPrice,stopPrice,quantity,minQuantity,maxQuantity,((displayQuantity,displayRefreshQuantity),displayReserveQuantity),bookingUnitQuantity,(timeInForceActivationDateTime,timeInForceExpirationDateTime),efpText,rerouteOfOrderInstructionId,beneficiaryLegalEntity,netOrCommFormula,netOrCommAmount,originatorId,handlerId,originatorPublicId,handlerPublicId,directedExecutionVenue,directedOrderHandlingService,originatorDesignatedLegalEntity,originatorTradingPerson,originatorLegalEntity,handlerTradingPerson,handlerLegalEntity),)' :43:16 error: Element 'simpleOrder' is not valid for content model: '(request|order)' The first error looks like it is because I didn't fill in a mandatory element of an optional sequence contained within orderInstruction. Unfortunately, that case didn't get detected at compile/run time in the serialization flow, only during parsing. Here is the offending sequence: The second error appears to be complaining that the message contains a simpleOrder in the order "slot", yet I believe that is allowed by substitution group: Is that an xsd-tree bug or some issue with my code/schema? Ray ________________________________ Ray Rizzuto raymond.rizzuto@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. From Raymond.Rizzuto at sig.com Mon Jul 14 15:57:13 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] comparison operation Message-ID: I ran into an issue comparing two XML objects after a round trip of XML Object->XML string->XML Object. I traced through the comparison code to find what was being declared different. It turned out to be in a dateTime because of comparison of the seconds. In the original object, I set seconds to 5.0976991653442383 This is serialized as 05.097699, and then the new object has the value 5.0976990000000004 So, there are two effects going on here. One is that the serialization to XML loses digits after microseconds. The other is conversion from a string to a double can run into representation issues. I am not sure if it is worth addressing the first issue - microseconds may be sufficient for most purposes. In my code, I think I can limit the value to 6 decimal places fairly easily. The representation issue isn't an issue for precision, but it certainly affects any comparison of types that rely on doubles. I'm not sure if there is a good answer here. Ray ________________________________ Ray Rizzuto raymond.rizzuto@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. From boris at codesynthesis.com Mon Jul 14 16:08:26 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] RE: parser issue In-Reply-To: References: Message-ID: <20080714200826.GA4395@karelia> Hi Ray, Rizzuto, Raymond writes: > I am a bit concerned that it was so easy to generate invalid output, > however. Why didn't the serialize call throw an exception indicating > this error? The C++/Tree mapping does not perform validation during serialization. As I mentioned earlier, we are working on another C++/Tree-like mapping which will support validation in generated code for both parsing and serialization. There is also a work-around for this in C++/Tree which involves re-parsing the serialized XML to make sure it is valid. For more information please see the following post: http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001793.html Boris From boris at codesynthesis.com Mon Jul 14 16:19:16 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] comparison operation In-Reply-To: References: Message-ID: <20080714201916.GB4395@karelia> Hi Ray, Rizzuto, Raymond writes: > So, there are two effects going on here. One is that the serialization to > XML loses digits after microseconds. The other is conversion from a string > to a double can run into representation issues. Correct on both counts. > I am not sure if it is worth addressing the first issue - microseconds > may be sufficient for most purposes. In my code, I think I can limit > the value to 6 decimal places fairly easily. Yes, we have to pick some default value and microseconds seems like a reasonable compromise. You always have an option to customize the dateTime type and serialize the seconds component with your desired precision. > The representation issue isn't an issue for precision, but it certainly > affects any comparison of types that rely on doubles. I'm not sure if > there is a good answer here. I don't think there is a practical solution to this one since that's how floating point types work. So the only suggestion I can offer is to choose floating point values for your test so that they don't trigger this problem. Boris From Raymond.Rizzuto at sig.com Mon Jul 14 16:24:21 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] RE: parser issue In-Reply-To: <20080714200826.GA4395@karelia> References: <20080714200826.GA4395@karelia> Message-ID: Boris, Thanks, I knew there were limitations in the validation, but was surprised that in the case of a choice it actually serialized both choices that I incorrectly populated. I actually am parsing the serialized code, which is where I noticed the error message ":43:16 error: Element 'simpleOrder' is not valid for content model: '(request|order)'". One of our XML experts was able to identify the error in the generated XML, luckily, as I was misinterpreting what the error message was saying. Ray -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Monday, July 14, 2008 4:08 PM To: Rizzuto, Raymond Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] RE: parser issue Hi Ray, Rizzuto, Raymond writes: > I am a bit concerned that it was so easy to generate invalid output, > however. Why didn't the serialize call throw an exception indicating > this error? The C++/Tree mapping does not perform validation during serialization. As I mentioned earlier, we are working on another C++/Tree-like mapping which will support validation in generated code for both parsing and serialization. There is also a work-around for this in C++/Tree which involves re-parsing the serialized XML to make sure it is valid. For more information please see the following post: http://www.codesynthesis.com/pipermail/xsd-users/2008-June/001793.html Boris 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. From boris at codesynthesis.com Tue Jul 15 14:51:20 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] RE: parser issue In-Reply-To: References: <20080714200826.GA4395@karelia> Message-ID: <20080715185120.GC17761@karelia> Hi Ray, Rizzuto, Raymond writes: > Thanks, I knew there were limitations in the validation, but was > surprised that in the case of a choice it actually serialized both > choices that I incorrectly populated. The following thread has more information on why this is the case: http://www.codesynthesis.com/pipermail/xsd-users/2007-March/000863.html Boris From azbwilcox at yahoo.com Tue Jul 15 16:15:01 2008 From: azbwilcox at yahoo.com (Bryan Wilcox) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Code Synthesis use question Message-ID: <598195.38959.qm@web51907.mail.re2.yahoo.com> Hello, ??? I am new to this list and using Code-Synthesis.? I had a question I came across trying work with some code generated by the tool.? I have a data item in my schema that is represented by xsd:anySimpleType.? In the generated code this is represented by an object of type "typedef ::xsd::cxx::tree::simple_type< type > simple_type;"? I am trying to find an object in a list that has a value in this field based on a string I want to compare it to.? However, I am having problems doing comparisons on the objects based on simple_type.? I was hoping someone could help me figure out what I am doing wrong and I don't see any examples of how to do this in the documentation.? In the standard library equivalent, what I would like to be able to do is do a std::set find operation on this container and pass in the string value as a key.? Is this possible? ? Thanks, Bryan From boris at codesynthesis.com Tue Jul 15 17:01:11 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Code Synthesis use question In-Reply-To: <598195.38959.qm@web51907.mail.re2.yahoo.com> References: <598195.38959.qm@web51907.mail.re2.yahoo.com> Message-ID: <20080715210111.GE17761@karelia> Hi Bryan, Bryan Wilcox writes: > I have a data item in my schema that is represented by xsd:anySimpleType. > In the generated code this is represented by an object of type > "typedef ::xsd::cxx::tree::simple_type< type > simple_type;"? I am > trying to find an object in a list that has a value in this field > based on a string I want to compare it to.? However, I am having > problems doing comparisons on the objects based on simple_type. xsd:anySimpleType is a special XML Schema type which allows any (simple) content and the XSD-generated object model does not automatically extract the data for elements/attributes of this type. There aren't many reasons to prefer this type over, say, xsd:string since you get exactly the same content. So the simplest way to resolve this would be to replace xsd:anySimpleType with xsd:string in your schema. If you cannot modify the schema, then there are several way to get to the raw content of elements/attributes of this type. The first is to request the parsing function to establish association between DOM nodes and object model nodes. This way you can obtain a DOMNode corresponding to element/attribute of xsd:anySimpleType and then get the text content from there. For more information see Section 5.1, "DOM Association" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#5.1 As well as the 'mixed' example in examples/cxx/tree/mixed/. The second approach involves customizing the type which contains element/attribute of xsd:anySimpleType and extracting the data in this type's parsing constructor. For more information on how to do this see the 'wildcard' example in examples/cxx/tree/custom/wildcard. While this example shows how to extract the data corresponding to XML Schema wildcards, handling of elements/attributes with the xsd:anySimpleType type will be pretty much the same. Boris From boris at codesynthesis.com Wed Jul 16 11:32:05 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Code Synthesis use question In-Reply-To: <604227.81004.qm@web51905.mail.re2.yahoo.com> References: <20080715210111.GE17761@karelia> <604227.81004.qm@web51905.mail.re2.yahoo.com> Message-ID: <20080716153205.GF12679@karelia> Hi Bryan, In the future please keep your replies CC'ed to the xsd-users mailing list. This way other developers who may have experienced a similar problem can provide you with a solution. Plus questions and answers will be archived and available to others with similar problems. Bryan Wilcox writes: > One more quick clarification if you have the time.? > ? > The issue has to do with this generated code below.?? > ??? typedef ::axm::Definition definition_type; > ??? /** > ???? * @brief Element sequence container type. > ???? */ > ??? typedef ::xsd::cxx::tree::sequence< definition_type > definition_sequence; > ... > ??? protected: > ??? definition_sequence definition_; > > and axm::Defintion is a base class for a number of derived classes any > of which can be inserted into the defintion_sequence defintion_.? If I > am iterating over the container defintion_, what is the type of the > sequence iterator?? Does it work like std::library iterators where > definition_sequence::const_iterator is an iterator and * of this > would give you an object reference into the container of type > defintion_type?? Or using the -> operator on the sequence will also > allow you to access the underlying defintion_type reference?? > Furthermore, since defintion_type is a base class, will > dynamic_cast( &(*theDefItr) ) give me a > pointer to a derived view of the object the iterator is on?? > I believe that this is the case but wasn't sure where the best > place to find documentation on how to use the sequence container was. Ok, you seem to be using XML Schema polymorphism in the form of xsi:type or substitution groups and this is one of those few cases where it makes sense to use xsd:anySimpleType as an abstract base. If you compile your schemas with the --generate-polymorphic option then the assumptions you outlined above are correct: the sequence will contain objects of varying dynamic types and you will be able to discover their types at runtime using, for example, dynamic_cast. This is all discussed in more detail and with examples in Section 2.11, "Mapping for xsi:type and Substitution Groups" of the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11 If you are not using xsi:type-based dynamic typing or substitution groups then we will need to see the relevant parts of your schema and XML document to better understand what you are trying to achieve. Boris From Raymond.Rizzuto at sig.com Wed Jul 16 15:46:51 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] suggestion Message-ID: I'd like to make a minor suggestion. Could the xsd compiler put the command line used to generate the output files into those output files as a comment? ________________________________ Ray Rizzuto raymond.rizzuto@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. From boris at codesynthesis.com Thu Jul 17 09:47:25 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] suggestion In-Reply-To: References: Message-ID: <20080717134725.GA24520@karelia> Hi Ray, Rizzuto, Raymond writes: > I'd like to make a minor suggestion. Could the xsd compiler put the > command line used to generate the output files into those output files > as a comment? It would be impossible to put the exact command line into the generated code because of shell expansions. Here is an example that shows what I mean: $ xsd cxx-tree --accessor-regex "/(.+)/get_$$1/" test.xsd The XSD compiler sees it as the following elements in a string array: cxx-tree --accessor-regex /(.+)/get_$1/ test.xsd As you can see "'s and $$ are gone. If someone tries to use a command line based on these values, they will get an error. But I think there is a much better approach that is available right now. You can put all your options in an options file (where not shell quoting or escaping is necessary), one options per line, for example: # test.options # --accessor-regex /(.+)/get_$1/ Then you can add options to this file to include itself as a comment in the generated code: # test.options # --accessor-regex /(.+)/get_$1/ # The following options include this options file into generated # files. # --prologue /* --prologue This file was generated with the following options file: --prologue-file test.options # end test.options # */ Then, when compiling your schema you run the compiler like this: $ xsd cxx-tree --options-file test.options test.xsd You can also include this command line in the comment if you like. Boris From rakirtley at bellsouth.net Thu Jul 17 08:49:25 2008 From: rakirtley at bellsouth.net (rakirtley@bellsouth.net) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] File-per-type Code Generation Message-ID: <071720081249.27601.487F3FD500035CFF00006BD122230706129B0A02D2089B9A019C04040A0DBF970A049B9D07050E9D@att.net> Boris, First let me say that (IMHO as a new user) XSD is a terrific product, a great time-saver for anyone working with XML based apps and well positioned in the marketplace. In other words, I wish I'd thought of it. I've encountered what appears to be a bad behavior with C++/Tree when using the file-per-type code generation option. I have a schema which includes a recursive relationship. When I do single file code generation, everything gets generated correctly. When I use the file-per-type option xsd consumes resources until it aborts. I did a work around where I change the recursive element to a simple type, generate code then modify the generated code manually to restore the correct relationship. Here is the schema snippet that causes the problem: Not a problem for me, but I figured I should at least report it. Thanks, Rance Kirtley From boris at codesynthesis.com Thu Jul 17 14:05:28 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] File-per-type Code Generation In-Reply-To: <071720081249.27601.487F3FD500035CFF00006BD122230706129B0A02D2089B9A019C04040A0DBF970A049B9D07050E9D@att.net> References: <071720081249.27601.487F3FD500035CFF00006BD122230706129B0A02D2089B9A019C04040A0DBF970A049B9D07050E9D@att.net> Message-ID: <20080717180528.GA32352@karelia> Hi Rance, rakirtley@bellsouth.net writes: > First let me say that (IMHO as a new user) XSD is a terrific product, a > great time-saver for anyone working with XML based apps and well > positioned in the marketplace. In other words, I wish I'd thought of it. Thanks, I am glad you enjoy it :-). > I've encountered what appears to be a bad behavior with C++/Tree when > using the file-per-type code generation option. I have a schema which > includes a recursive relationship. When I do single file code generation, > everything gets generated correctly. When I use the file-per-type option > xsd consumes resources until it aborts. I did a work around where I > change the recursive element to a simple type, generate code then modify > the generated code manually to restore the correct relationship. Here > is the schema snippet that causes the problem: > > > > > > > > > > > > > I confirm there is a bug in 3.1.0 that it triggered by this schema in the file-per-type mode. It was also already fixed for the upcoming 3.1.1. If you would like to verify this on your schema or if you need the fix, here are the recent pre-release binaries for Windows and GNU/Linux: http://www.codesynthesis.com/~boris/tmp/xsd-3.1.1.a7-i686-windows.zip http://www.codesynthesis.com/~boris/tmp/xsd-3.1.1.a7-i686-linux-gnu.tar.bz2 > Not a problem for me, but I figured I should at least report it. Thanks, we appreciate bug reports very much! Boris From michael.coulman at mac.com Thu Jul 17 16:32:39 2008 From: michael.coulman at mac.com (Michael Coulman) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] DbXml update Message-ID: <3542C03D-B2DB-42F7-8662-274762AFF612@mac.com> ???????????? ?????, I use DbXml as a persistent backend for XML instance documents modeled by XSD. The DbXml upgrade from 2.3.x to 2.4.x (including update from Xerces-2.7 to 2.8) removes DOM access. Removed all C++ interfaces that used Xerces-C DOM, including: ? XmlDocument::setContentAsDOM() ? XmlDocument::getContentAsDOM() ? XmlValue::asNode() This, in turn, breaks the dbxml/driver.cxx example code: g++ -I../../../../libxsd -DDBXML_DOM -I/opt/local/include -W -Wall -c driver.cxx -o driver.o driver.cxx: In function ?int main()?: driver.cxx:83: error: ?class DbXml::XmlDocument? has no member named ?getContentAsDOM? driver.cxx:117: error: ?class DbXml::XmlDocument? has no member named ?getContentAsDOM? driver.cxx:140: error: ?class DbXml::XmlValue? has no member named ?asNode? driver.cxx:156: error: ?class DbXml::XmlValue? has no member named ?asNode? make: *** [driver.o] Error 1 DbXml provides one work around for getContentAsDOM in their xercesDomTranslator example code. Similar logic might be used to replace the XSD dbxml/driver.cxx idiom // Create an object model from the document fragment. // auto_ptr b ( new book ( *static_cast (v.asNode ()))); by returning a *DOMNode from a method in xercesDomTranslator. I'm stuck on what to do with the XSD dbxml/driver.cxx idiom // Update the document fragment from the object model. // *static_cast (v.asNode ()) << *b; Anyone else facing this issue that would like to share a clue with me? TIA, -- Michael Coulman michael.coulman@mac.com From boris at codesynthesis.com Fri Jul 18 08:53:01 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] DbXml update In-Reply-To: <3542C03D-B2DB-42F7-8662-274762AFF612@mac.com> References: <3542C03D-B2DB-42F7-8662-274762AFF612@mac.com> Message-ID: <20080718125301.GB6852@karelia> Hi Michael, Michael Coulman writes: > The DbXml upgrade from 2.3.x to 2.4.x (including update from Xerces-2.7 > to 2.8) removes DOM access. > > Removed all C++ interfaces that used Xerces-C DOM, including: > XmlDocument::setContentAsDOM() > XmlDocument::getContentAsDOM() > XmlValue::asNode() Some time ago the DB XML folks have told me that they are considering this. > DbXml provides one work around for getContentAsDOM in their > xercesDomTranslator example code. > > Similar logic might be used to replace the XSD dbxml/driver.cxx idiom > > // Create an object model from the document fragment. > // > auto_ptr b ( > new book ( > *static_cast (v.asNode ()))); > > by returning a *DOMNode from a method in xercesDomTranslator. > > I'm stuck on what to do with the XSD dbxml/driver.cxx idiom > > // Update the document fragment from the object model. > // > *static_cast (v.asNode ()) << *b; > I took a look at the API changes and it seem that updates to fragments of a document are not possible with the new XmlEventWriter mechanism. That is, you can read/write the whole document, you can also read a fragment, but you cannot write a fragment. I've written to the DB XML folks to find out if they have plans to support this in the near future. Will let you know what they say. Boris From azbwilcox at yahoo.com Mon Jul 21 19:19:56 2008 From: azbwilcox at yahoo.com (Bryan Wilcox) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Parsing Question Message-ID: <366950.83034.qm@web51909.mail.re2.yahoo.com> I am curious about the parsing functions that are generated for standard input streams.? Is it possible to pass in some object or configuration to force the parser to use a locally defined schema object instead of attempting to access the schema at the Internet path provided in the instance document?? I didn't see any overload that appeared to do this in the generated code, but I am new to using this tool.? I know that in the past we were able to configure the Xerces C++ parser to do this(we store schemas in application resource files so that running the app can use Xerces parsing without requiring Internet access), but I wasn't sure if the generated code allowed this? ? Thanks, Bryan ? ps.? I am able to read in my input files if I first use our Xerces C++ code to convert the XML file to a xercesc::DOMDocument, but would prefer to just use straight file streams, if possible. From boris at codesynthesis.com Tue Jul 22 09:53:44 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Parsing Question In-Reply-To: <366950.83034.qm@web51909.mail.re2.yahoo.com> References: <366950.83034.qm@web51909.mail.re2.yahoo.com> Message-ID: <20080722135344.GA2581@karelia> Hi Bryan, Bryan Wilcox writes: > Is it possible to pass in some object or configuration to force the > parser to use a locally defined schema object instead of attempting > to access the schema at the Internet path provided in the instance > document? Yes, you can use the schema_location and no_namespace_schema_location properties as shown in Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From azbwilcox at yahoo.com Tue Jul 22 12:09:15 2008 From: azbwilcox at yahoo.com (Bryan Wilcox) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Parsing Question In-Reply-To: <20080722135344.GA2581@karelia> Message-ID: <284079.69416.qm@web51903.mail.re2.yahoo.com> Thanks.? That looks more like what I was looking for.? But what we do is load the schemas from a Windows resource file into a xerces DOMInputSource using a std::string and then use the DomBuilder's loadGrammar to load that schema input source into the parser.? I searched through the CodeSynthesis code and didn't see any obvious way to do this.? I appreciate your feedback. ? Sincerely, Bryan --- On Tue, 7/22/08, Boris Kolpackov wrote: From: Boris Kolpackov Subject: Re: [xsd-users] Parsing Question To: "Bryan Wilcox" Cc: xsd-users@codesynthesis.com Date: Tuesday, July 22, 2008, 7:53 AM Hi Bryan, Bryan Wilcox writes: > Is it possible to pass in some object or configuration to force the > parser to use a locally defined schema object instead of attempting > to access the schema at the Internet path provided in the instance > document? Yes, you can use the schema_location and no_namespace_schema_location properties as shown in Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From boris at codesynthesis.com Tue Jul 22 14:38:44 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Parsing Question In-Reply-To: <284079.69416.qm@web51903.mail.re2.yahoo.com> References: <20080722135344.GA2581@karelia> <284079.69416.qm@web51903.mail.re2.yahoo.com> Message-ID: <20080722183844.GB2581@karelia> Hi Bryan, Bryan Wilcox writes: > But what we do is load the schemas from a Windows resource file into > a xerces DOMInputSource using a std::string and then use the DomBuilder's > loadGrammar to load that schema input source into the parser.? I > searched through the CodeSynthesis code and didn't see any obvious > way to do this. For that you will need to use the Xerces-C++ API. Normally, when you want to do something like this (pre-parse and cache the schemas) you would also want to re-use the parser to parse multiple documents for better performance. This is shown in the examples/cxx/tree/cache/ example. Boris From mburnham at gblsys.com Tue Jul 22 16:21:23 2008 From: mburnham at gblsys.com (Matt Burnham) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] llink issues References: C186D1A6FE48F8409DB97F6AE99A61BA12337E66@msgbal500.ds.susq.com Message-ID: <48864143.7080900@gblsys.com> I'm having the same problem reported here (http://www.codesynthesis.com/pipermail/xsd-users/2008-January/001427.html), except it's with my own project rather than the examples (which compile and link fine using the xerces-8.0 libs). I'm using version 3.0 and the project was originally created with VS 2003 then was converted to VS 2005. When I link using the xerces-8.0 libraries, I get "unresolved external symbol" errors, but it links (and runs) fine using the xerces-7.1 libraries. I've checked and only have the xerces libs that came with XSD and have the "Treat wchar_t as Built-in Type" option set to "yes". I use the following xsd command line options: --root-element --namespace-map --generate-inline --generate-ostream --generate-serialization Thanks, -matt From boris at codesynthesis.com Tue Jul 22 16:43:56 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] llink issues In-Reply-To: <48864143.7080900@gblsys.com> References: <48864143.7080900@gblsys.com> Message-ID: <20080722204356.GD2581@karelia> Hi Matt, Matt Burnham writes: > except it's with my own project rather than the examples (which compile > and link fine using the xerces-8.0 libs). > > I'm using version 3.0 and the project was originally created with VS > 2003 then was converted to VS 2005. When I link using the xerces-8.0 > libraries, I get "unresolved external symbol" errors, but it links (and > runs) fine using the xerces-7.1 libraries. I've checked and only have > the xerces libs that came with XSD and have the "Treat wchar_t as > Built-in Type" option set to "yes". The fact that the examples compile and link fine means that the Xerces-C++ libraries are fine and there is something wrong with the converted project. I can't think of anything off the top of my head so I suggest that you try to see what is different in terms of compiler/linker settings between your project and one of the examples. Things that I would check first are: 1. Make sure the "Treat wchar_t as built-in type" option is set to the same value. 2. Make sure that the same Xerces-C++ library is linked and in the same way. 3. Check that the same generated code type is used (e.g., Debug/MT/DLL, etc). If all this doesn't help then the last resort would be to re-create the VS 8.0 project from scratch instead of using the conversion tool. Boris From Raymond.Rizzuto at sig.com Wed Jul 23 16:32:24 2008 From: Raymond.Rizzuto at sig.com (Rizzuto, Raymond) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] windows and linux differences Message-ID: I'm working to move my Windows XSD environment over to Linux - actually I need to be able to use either environment. In the process, I hit the "regex and shell quoting" issue mentioned in the compiler command line manual. I tried using -options-file, and that worked, but there is one issue. The Linux version of XSD doesn't like DOS line endings, and gives this strange error: rizzuto@proptrdevbal806:~/p4root/sdmp/Source/SusexUSA/Server/SDMP/Libs/XSDLib> xsd cxx-tree --options-file options SDMP.xsd ' info: try 'xsd help' for usage information I converted the options file with dos2unix, and then did not get the error. Luckily the Windows version of XSD is o.k. with Unix line endings, so I do finally have a single solution for both Windows and Linux. Ray ________________________________ Ray Rizzuto raymond.rizzuto@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. From boris at codesynthesis.com Fri Jul 25 02:39:18 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Xerces-C++ 3.0.0 beta 2 and XSD 3.1.0 Message-ID: <20080725063918.GC19826@karelia> Hi, Some of you might have noticed that the Xerces-C++ project has released the second 3.0.0 beta[*]. Due to some interface changes this beta won't work with XSD 3.1.0. We are planning to release a beta for XSD 3.1.1 in the next couple of weeks which will include support for Xerces-C++ 3.0.0 beta 2 as well as the final release. [*] http://marc.info/?l=xerces-c-users&m=121692508501507&w=2 Boris From boris at codesynthesis.com Fri Jul 25 04:40:13 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] windows and linux differences In-Reply-To: References: Message-ID: <20080725084013.GG19826@karelia> Hi Ray, Rizzuto, Raymond writes: > I tried using -options-file, and that worked, but there is one issue. > The Linux version of XSD doesn't like DOS line endings, and gives this > strange error: Fixed for the upcoming 3.1.1. Thanks for reporting this! Boris From david.r.moss at selex-comms.com Fri Jul 25 08:36:44 2008 From: david.r.moss at selex-comms.com (david.r.moss@selex-comms.com) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] VC 9.0 & optional type conversion. In-Reply-To: <20080707204500.GE6440@karelia> Message-ID: Hi, Given the following schema: The following code complies under VC71 but not VC90: // Test. vc90 ambiguous function call between // optional and non-optional overloads. ns1_type ns1(0); ns1.fund_int( ns1.cust_int() ); Any ideas?! Cheers, Dave. Dave Moss SELEX Communications Grange Road Christchurch Dorset BH23 4JE United Kingdom Tel: + 44 (0) 1202 404841 Email: david.r.moss@selex-comms.com ------------------------------------------------------------ This email and any attached files contains company confidential information which may be legally privileged. It is intended only for the person(s) or entity to which it is addressed and solely for the purposes set forth therein. If you are not the intended recipient or have received this email in error please notify the sender by return, delete it from your system and destroy any local copies. It is strictly forbidden to use the information in this email including any attachment or part thereof including copying, disclosing, distributing, amending or using for any other purpose. In addition the sender excludes all liabilities (whether tortious or common law) for damage or breach arising or related to this email including but not limited to viruses and libel. SELEX Communications Limited is a Private Limited Company registered in England and Wales under Company Number 964533 and whose Registered Office is Lambda House, Christopher Martin Rd, Basildon, SS14 3EL. England. From boris at codesynthesis.com Fri Jul 25 10:10:07 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] VC 9.0 & optional type conversion. In-Reply-To: References: <20080707204500.GE6440@karelia> Message-ID: <20080725141007.GA25345@karelia> Hi David, david.r.moss@selex-comms.com writes: > The following code complies under VC71 but not VC90: > > // Test. vc90 ambiguous function call between > // optional and non-optional overloads. > ns1_type ns1(0); > ns1.fund_int( ns1.cust_int() ); This is apparently caused by the following two implicit conversion operators that are defined in the fundamental_base class template (libxsd/xsd/cxx/tree/elements.hxx:1235): template operator Y () const { return x_; } template operator Y () { return x_; } They were disabled for 7.1 because they cause ICE to this compiler. Since they are rarely used we have disabled them by default in the next release. You can also comment them out in your copy of XSD as a work around. Thanks for reporting this! Boris From prokher at gmail.com Thu Jul 31 08:18:11 2008 From: prokher at gmail.com (Alexander A. Prokhorov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Encoding 'ru_RU.cp1251' trouble. Message-ID: <4891AD83.4020701@gmail.com> Hiall. In there anybody knows is it possible to use xsd serialization for non-utf-encoded strings? This small program gets word from stdin and outputs xml to stdout. It coredumps with exception "terminate called after throwing an instance of 'xsd::cxx::xml::invalid_utf8_string'" if I input word in ru_RU.cp1251 encoding. How can I fix this? main.cpp: { std::string word; std::cin >> word; Hypothesis hypothesis(word); Reply reply(hypothesis); xml_schema::namespace_infomap map; map[""].name = ""; map[""].schema = "reply.xsd"; SpellChecker::reply(std::cout, reply, map, "windows-1251"); } reply.xsd: From boris at codesynthesis.com Thu Jul 31 08:46:49 2008 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] Encoding 'ru_RU.cp1251' trouble. In-Reply-To: <4891AD83.4020701@gmail.com> References: <4891AD83.4020701@gmail.com> Message-ID: <20080731124649.GA10782@karelia> Hi Alexander, Alexander A. Prokhorov writes: > This small program gets word from stdin and outputs xml to stdout. It > coredumps with exception "terminate called after throwing an instance of > 'xsd::cxx::xml::invalid_utf8_string'" if I input word in ru_RU.cp1251 > encoding. How can I fix this? All strings in the object model can contains characters encoded using one of the following three ways: 1. char/UTF-8 (default) 2. char/local code page 3. wchar_t/UTF-32 or UTF-16, depending on the size of wchar_t See Q 1.2 in the C++/Tree Mapping FAQ for details: http://wiki.codesynthesis.com/Tree/FAQ In your case, choosing options (2) might do the trick through this might not work on some platforms as mentioned in the FAQ. Boris From Mark.Stevens at dtn.com Thu Jul 31 18:50:05 2008 From: Mark.Stevens at dtn.com (Mark Stevens) Date: Sun Oct 11 15:34:05 2009 Subject: [xsd-users] serialization without pretty print Message-ID: <93E3AED1E31FB448AD0BDBE14BA50B1D02397380@EX01.dtn.com> Hi, I am also interested in switching off pretty print dynamically. Per the message below, it appears that a patch was made in version 3.1.1. Do you have a release date for a Solaris sparc bin release with this patch included? Thanks. Mark Mark Stevens System Design Engineer DTN 9110 West Dodge Road, Suite 200 Omaha, NE 68114 mark.stevens@dtn.com Phone: 402-255-8015 Fax: 402-255-8825 www.dtn.com DTN Smarter Decisions [xsd-users] Re: xsd-users Digest, Vol 32, Issue 14 serialization without pretty print Gordon Kramer gkr at as-guides.com Tue Mar 11 07:20:23 EDT 2008 * Previous message: [xsd-users] Roundtrip errors with CXX-Tree * Next message: [xsd-users] serialization without pretty print * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] ________________________________ Hi, I am also interested in switching off pretty print dynamically. > > One tiny question/wish: streaming out xml with std::ofstream created > > an extra carriage return symbol after each element: > > > > > > Hello > > > > its me > > > > > > > > How to drop it? > > XSD uses DOMWriter provided by Xerces-C++ to serialize to XML. > It turns the format-pretty-print feature on by default which produces > the result you see (BTW, I believe it adds extra new lines only for > element that are directly under the root so real documents with several > nesting levels actually look better with these extra newlines than > without them). > > You only other option is to turn pretty-printing off altogether in which > case you will get unformatted XML. To do this you will need to set the > DOM-to-XML serialization stage yourself and switch the > format-pretty-print feature off on the DOMWriter object. For more > information see Q3.2 in the C++/Tree Mapping FAQ: > > http://wiki.codesynthesis.com/Tree/FAQ > > As well as the Xerces-C++ DOMWriter documentation: > > http://xerces.apache.org/xerces-c/program-dom.html#DOMWriterFeatures > > Boris > having had a look at the code it doesn't look too complicated by introducing another serialisation flag no_pretty_print. please find attached a patch for this proposal I did not add a test for this feature yet. Gordon -------------- next part -------------- A non-text attachment was scrubbed... Name: xsd_no_pretty_print.patch Type: text/x-patch Size: 2225 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20080311/2094cf 3d/xsd_no_pretty_print.bin ----------------------------------------- NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.