From boris at codesynthesis.com Mon Dec 3 10:06:24 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Dec 3 09:24:30 2012 Subject: [xsd-users] equivalent of @XmlSeeAlso in code synthesis In-Reply-To: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D329@MX26A.corp.emc.com> References: <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147D70AA64@MX26A.corp.emc.com> <0DB3CF5C512BBD4FA7E3A8ECD8FE7352147FF9D329@MX26A.corp.emc.com> Message-ID: Hi Arul, Prakash, Arul writes: > I also found this, it says whatever you have mentioned is not correct. I am curious to know, what exactly that I have mentioned is not correct? Your second email didn't explain anything further, as you have promised. > auto_ptr b (base::Elem("test.xml"); > now how can I access the "Timeout" attribute defined in derived_schema.xsd. Did you try something along these lines: if (derived::Derived* d = dynamic_cast (b.get ())) { // Access timeout vis 'd'. } ? Boris From alejandro.claro at gmail.com Wed Dec 5 10:12:39 2012 From: alejandro.claro at gmail.com (Alejandro Claro) Date: Wed Dec 5 10:03:40 2012 Subject: [xsd-users] Needs help removing underscore character in anonymous regex option Message-ID: Hi everyone, I need help to improve anonymous types with anonymous-regex option or any other option could make it work. My problem is that I have many XSD files and some anonymous gets the same name with the usual options, so at compilation I get multiples definitions of the type. I'm trying to fix this by generate the name of the anonymous type as the concatenation of the parts of the XPath with this regex -anonymous-regex '%.* .* (.+/)*(.+)%\u$1\u$2%' but I don't like the '/', '-' and '_' characters are replaced by '_' character in the type name. Is there a way to change the replacing character? I would like to set it to none ('') and would be wonderful if I can made the type name PascalCase after remove or replace the characters. If anyone have a better idea, please tell me. Thanks in advance, Alejandro Claro. -- "Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand. " - Albert Einstein. From boris at codesynthesis.com Wed Dec 5 11:00:01 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Dec 5 10:17:27 2012 Subject: [xsd-users] Needs help removing underscore character in anonymous regex option In-Reply-To: References: Message-ID: Hi Alejandro, Alejandro Claro writes: > -anonymous-regex '%.* .* (.+/)*(.+)%\u$1\u$2%' > > but I don't like the '/', '-' and '_' characters are replaced by '_' > character in the type name. > > Is there a way to change the replacing character? > > I would like to set it to none ('') and would be wonderful if I can made > the type name PascalCase after remove or replace the characters. You would need to create a series of regexes that handle one-word, two- word, etc., names. Then you can replace the delimiters with a character of your choice and also capitalize the words: --anonymous-regex '%.* .* (.+/)*([^-_]+)%\u$1\u$2%' --anonymous-regex '%.* .* (.+/)*([^-_]+)[-_]([^-_]+)%\u$1\u$2\u$3%' ... You may also want to place all these options into an options file (see the --options-file option) to make your command line more manageable. Boris From alejandro.claro at gmail.com Wed Dec 5 11:32:35 2012 From: alejandro.claro at gmail.com (Alejandro Claro) Date: Wed Dec 5 11:23:35 2012 Subject: [xsd-users] Needs help removing underscore character in anonymous regex option In-Reply-To: References: Message-ID: Thanks a lot Boris, This solution looks great but I get an error: invalid anonymous type regex: ''%.* .* (.+/)*([^-_]+)%\u$1\u$2%'': missing third pattern-substitution separator Thanks, Alejandro On Wed, Dec 5, 2012 at 11:00 AM, Boris Kolpackov wrote: > Hi Alejandro, > > Alejandro Claro writes: > > > -anonymous-regex '%.* .* (.+/)*(.+)%\u$1\u$2%' > > > > but I don't like the '/', '-' and '_' characters are replaced by '_' > > character in the type name. > > > > Is there a way to change the replacing character? > > > > I would like to set it to none ('') and would be wonderful if I can made > > the type name PascalCase after remove or replace the characters. > > You would need to create a series of regexes that handle one-word, two- > word, etc., names. Then you can replace the delimiters with a character > of your choice and also capitalize the words: > > --anonymous-regex '%.* .* (.+/)*([^-_]+)%\u$1\u$2%' > --anonymous-regex '%.* .* (.+/)*([^-_]+)[-_]([^-_]+)%\u$1\u$2\u$3%' > ... > > You may also want to place all these options into an options file (see > the --options-file option) to make your command line more manageable. > > Boris > -- "Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand. " - Albert Einstein. From alejandro.claro at gmail.com Wed Dec 5 12:25:56 2012 From: alejandro.claro at gmail.com (Alejandro Claro) Date: Wed Dec 5 12:16:56 2012 Subject: [xsd-users] Needs help removing underscore character in anonymous regex option In-Reply-To: References: Message-ID: Sorry Boris, It was my fault. In the options file, regular expression should not have quotation* *marks. Thanks a lot, Alejandro. On Wed, Dec 5, 2012 at 11:32 AM, Alejandro Claro wrote: > Thanks a lot Boris, > > This solution looks great but I get an error: > > invalid anonymous type regex: ''%.* .* (.+/)*([^-_]+)%\u$1\u$2%'': > missing third pattern-substitution separator > > Thanks, > Alejandro > > > On Wed, Dec 5, 2012 at 11:00 AM, Boris Kolpackov wrote: > >> Hi Alejandro, >> >> Alejandro Claro writes: >> >> > -anonymous-regex '%.* .* (.+/)*(.+)%\u$1\u$2%' >> > >> > but I don't like the '/', '-' and '_' characters are replaced by '_' >> > character in the type name. >> > >> > Is there a way to change the replacing character? >> > >> > I would like to set it to none ('') and would be wonderful if I can made >> > the type name PascalCase after remove or replace the characters. >> >> You would need to create a series of regexes that handle one-word, two- >> word, etc., names. Then you can replace the delimiters with a character >> of your choice and also capitalize the words: >> >> --anonymous-regex '%.* .* (.+/)*([^-_]+)%\u$1\u$2%' >> --anonymous-regex '%.* .* (.+/)*([^-_]+)[-_]([^-_]+)%\u$1\u$2\u$3%' >> ... >> >> You may also want to place all these options into an options file (see >> the --options-file option) to make your command line more manageable. >> >> Boris >> > > > > -- > "Imagination is more important than knowledge. For knowledge is limited to > all we now know and understand, while imagination embraces the entire > world, and all there ever will be to know and understand. " > - Albert Einstein. > -- "Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand. " - Albert Einstein. From owagh at tower-research.com Thu Dec 6 15:27:46 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Thu Dec 6 15:18:31 2012 Subject: [xsd-users] Make suitable dependency generation Message-ID: <50C0FFC2.7010200@tower-research.com> Does xsd currently support generating dependency files suitable for use with make? Something similar to gcc -M or gcc -MM ? Omkar From boris at codesynthesis.com Fri Dec 7 11:19:06 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Dec 7 10:35:58 2012 Subject: [xsd-users] Make suitable dependency generation In-Reply-To: <50C0FFC2.7010200@tower-research.com> References: <50C0FFC2.7010200@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Does xsd currently support generating dependency files suitable for use > with make? Something similar to gcc -M or gcc -MM ? This feature has been on our TODO list for a while but for some reason nobody was interested in it before you. Probably because schema's include graphs don't change that often so tracking dependencies manually is not an issue. But if you need this and willing to test it in a pre-release, I can go ahead an implement it. Boris From owagh at tower-research.com Fri Dec 7 15:09:23 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Fri Dec 7 15:00:00 2012 Subject: [xsd-users] Make suitable dependency generation In-Reply-To: References: <50C0FFC2.7010200@tower-research.com> Message-ID: <50C24CF3.5010907@tower-research.com> Hi Boris I'd be happy to test it in a pre-release version! We're making do with a manual graph that doesn't change a lot (as you mention) but it would just be better to have this done automatically by the compiler. Omkar On 12/07/2012 11:19 AM, Boris Kolpackov wrote: > Hi Omkar, > > Omkar Wagh writes: > >> Does xsd currently support generating dependency files suitable for use >> with make? Something similar to gcc -M or gcc -MM ? > This feature has been on our TODO list for a while but for some reason > nobody was interested in it before you. Probably because schema's include > graphs don't change that often so tracking dependencies manually is not > an issue. But if you need this and willing to test it in a pre-release, > I can go ahead an implement it. From Robert.Bielik at gyros.com Wed Dec 12 08:53:08 2012 From: Robert.Bielik at gyros.com (Bielik, Robert) Date: Wed Dec 12 08:43:10 2012 Subject: [xsd-users] Problem with assymmetry in serialization/deserialization Message-ID: <552280EBDB5A804689FADEE56384771903133A@VIEX01SE.ad-gyrosmicro.com> Hi all, I'm trying to use template functions to make for transparent serialization/deserialization, however, without -generate-element-map I can only make deserialization work through: template std::auto_ptr getTypedObject(DOMDocument* doc) { std::auto_ptr ret; try { ret.reset(new ObjectType(*doc->getDocumentElement())); } catch (std::exception&) { // Catch all } return ret; } which works nicely. However serializing is a whole other matter. To serialize the object CObjectXml I need to: schema_namespace::CObjectXml value(...); ::xml_schema::dom::auto_ptr< ::xercesc::DOMDocument > domdoc = schema_namespaces::CObjectXml_(value, contentMap); As you can see, there is no way to templatize this since the serialization relies on a static function named ObjectType_ (!) And with -generate-element-map I have no way to create a DOMDocument directly, since the serialization operators work on a DOMElement. Besides, it seems that whereas the ObjectType_ function correctly generated the top level DOMElement with name == "ObjectType", the latter serialization operators only serialize the CONTENT of ObjectType (i.e. no top element with name == "ObjectType"). I could really use some suggestions as how to accomplish what I want since the codebase is getting sickeningly large due to this... TIA /Rob From boris at codesynthesis.com Thu Dec 13 02:39:14 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 13 01:54:23 2012 Subject: [xsd-users] Problem with assymmetry in serialization/deserialization In-Reply-To: <552280EBDB5A804689FADEE56384771903133A@VIEX01SE.ad-gyrosmicro.com> References: <552280EBDB5A804689FADEE56384771903133A@VIEX01SE.ad-gyrosmicro.com> Message-ID: Hi Robert, Bielik, Robert writes: > Hi all, > > I'm trying to use template functions to make for transparent serialization/deserialization, however, without -generate-element-map I can only make deserialization work through: > > template > std::auto_ptr getTypedObject(DOMDocument* doc) > { > std::auto_ptr ret; > try > { > ret.reset(new ObjectType(*doc->getDocumentElement())); > } > catch (std::exception&) > { > // Catch all > } > return ret; > } > > which works nicely. > However serializing is a whole other matter. To serialize the object > CObjectXml I need to: > > schema_namespace::CObjectXml value(...); > ::xml_schema::dom::auto_ptr< ::xercesc::DOMDocument > domdoc = > schema_namespaces::CObjectXml_(value, contentMap); > > As you can see, there is no way to templatize this since the > serialization relies on a static function named ObjectType_ (!) As with parsing (deserialization in your terminology), you can serialize an object model instance directly into DOMElement. The difference between parsing and serialization is that in the latter case you need to know the root element name to create the DOM document with. And that's where the element type/map mechanism comes into play (see below). > And with -generate-element-map I have no way to create a DOMDocument > directly, since the serialization operators work on a DOMElement. > Besides, it seems that whereas the ObjectType_ function correctly > generated the top level DOMElement with name == "ObjectType", the > latter serialization operators only serialize the CONTENT of > ObjectType (i.e. no top element with name == "ObjectType"). Right, that's how serialization operators work. The important thing to keep in mind is that in the general case, the same complex type can be used in multiple root elements: ... So if all you pass to your serialization function is an instance of ObjectType, there is no way to know which root element it should use: Root1, Root2, something else? And that's exactly the reason why the element type/element map functionality was invented. An element type instance is basically the object plus the element name. So an easy way to solve your problem is instead of passing the complex type instance to the serialization function, you pass the element type instance. Take a look at the 'messaging' example, specifically, driver.cxx. It has some code that does pretty much what you want using element types. Boris From alejandro.claro at gmail.com Thu Dec 13 16:58:51 2012 From: alejandro.claro at gmail.com (Alejandro Claro) Date: Thu Dec 13 16:48:46 2012 Subject: [xsd-users] Help with regex for typedef traits types Message-ID: Hi every one, Anybody knows if there is a way to change the name of the typedef generate by XSDCXX? What I want is to remove underscores. This and example: typedef ::Saes::Configuration::Serialization::XmlSchemasNecessaryList Xml_necessaryType; typedef ::xsd::cxx::tree::traits< Xml_necessaryType, char > Xml_necessaryTraits; I want to get XmlNecessaryType and XmlNecessaryTraits typedefs. I was able to change the getters, setter, etc but how change the typedef? Thanks in advance, Alejandro Claro. -- "Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand. " - Albert Einstein. From boris at codesynthesis.com Fri Dec 14 07:08:45 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Dec 14 06:23:30 2012 Subject: [xsd-users] Help with regex for typedef traits types In-Reply-To: References: Message-ID: Hi Alejandro, Alejandro Claro writes: > Anybody knows if there is a way to change the name of the typedef generate > by XSDCXX? What I want is to remove underscores. > > This and example: > > typedef ::Saes::Configuration::Serialization::XmlSchemasNecessaryList > Xml_necessaryType; > > typedef ::xsd::cxx::tree::traits< Xml_necessaryType, char > > Xml_necessaryTraits; > > I want to get XmlNecessaryType and XmlNecessaryTraits typedefs. Those are passed through the type regex (--type-regex). For *Type, the last component will be ',type', for *Traits -- ',traits', etc. See the NAMING CONVENTION section the XSD compiler command line manual (man pages). Boris From alejandro.claro at gmail.com Fri Dec 14 09:13:52 2012 From: alejandro.claro at gmail.com (Alejandro Claro) Date: Fri Dec 14 09:03:41 2012 Subject: [xsd-users] Help with regex for typedef traits types In-Reply-To: References: Message-ID: Thank you Boris, I wil try changing the --type-regex. I'm able to change the methods name with it but I it does not change the typedef. Let me check and change the regular expression. Alejandro. On Fri, Dec 14, 2012 at 7:08 AM, Boris Kolpackov wrote: > Hi Alejandro, > > Alejandro Claro writes: > > > Anybody knows if there is a way to change the name of the typedef > generate > > by XSDCXX? What I want is to remove underscores. > > > > This and example: > > > > typedef ::Saes::Configuration::Serialization::XmlSchemasNecessaryList > > Xml_necessaryType; > > > > typedef ::xsd::cxx::tree::traits< Xml_necessaryType, char > > > Xml_necessaryTraits; > > > > I want to get XmlNecessaryType and XmlNecessaryTraits typedefs. > > Those are passed through the type regex (--type-regex). For *Type, > the last component will be ',type', for *Traits -- ',traits', > etc. See the NAMING CONVENTION section the XSD compiler command > line manual (man pages). > > Boris > -- "Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand. " - Albert Einstein. From salva.brice at gmail.com Mon Dec 17 12:11:58 2012 From: salva.brice at gmail.com (brice salva) Date: Mon Dec 17 12:01:42 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing Message-ID: Hi Boris, First of all, thank you for providing such tool as xsd-cs, this is really helpful for C++ developpers. Now, unfortunately, I face an issue I am not able to solve without consulting you. I am trying to serialize and then parse a Soap Fault with xsd-cs. Here is the output: -------------------------------- SERIALIZING fault --------------------------------
Server Error : invalid message -------------------------------- PARSING fault -------------------------------- parsing : error during validation: message 01:17:30:value 'Server' not in enumeration Indeed, the element "Value" element must respect : (see http://www.w3.org/2003/05/soap-envelope) Here, when serializing, xsd-cs builds and xml message without prefixing the namespace of the root element ; hence the "Value" text is not qualified by any prefix, which is fair. But then, the parsing should be in line with this logic, and this is not the case : the error message shows that a prefix is expected. Note that I cannot use the namespace infomap to force a prefix because I am parsing and serializing the xml data with the generic element_map/element_type logic. Here is an extract that shows how I build the body of the fault: aBody.fault( soapEnv::Fault ( soapEnv::Faultcode ( soapEnv::FaultcodeEnum ( xml_schema::Qname(soapEnv::EnvelopeElement::namespace_(),"Server") ) ), aFaultReason ) ); Could you tell me how to deal with qname elements and more generally how to parse/serialize them in a soap fault context with xsd-cs ? Many thanks, Brice From boris at codesynthesis.com Tue Dec 18 06:50:36 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Dec 18 06:04:10 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing In-Reply-To: References: Message-ID: Hi Brice brice salva writes: > First of all, thank you for providing such tool as xsd-cs, this is really > helpful for C++ developpers. Thanks, I am glad you are enjoying it. > parsing : error during validation: message 01:17:30:value 'Server' not in > enumeration Which version of Xerces-C++ are you using? This sounds very much like the bug[1] that has been fixed in 3.0.0. [1] https://issues.apache.org/jira/browse/XERCESC-1441 Boris From boris at codesynthesis.com Wed Dec 19 03:46:20 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Dec 19 02:59:41 2012 Subject: [xsd-users] Make suitable dependency generation In-Reply-To: <50C24CF3.5010907@tower-research.com> References: <50C0FFC2.7010200@tower-research.com> <50C24CF3.5010907@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > I'd be happy to test it in a pre-release version! Ok, I've implemented this feature and it is ready to try. Can you let me know which platform you are using so that I can build you a pre- release? Boris From salva.brice at gmail.com Thu Dec 20 01:05:25 2012 From: salva.brice at gmail.com (brice salva) Date: Thu Dec 20 00:54:29 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing In-Reply-To: References: Message-ID: Hi Boris, Actually, this is the 3.1.1. Brice Hi Brice brice salva writes: > First of all, thank you for providing such tool as xsd-cs, this is really > helpful for C++ developpers. Thanks, I am glad you are enjoying it. > parsing : error during validation: message 01:17:30:value 'Server' not in > enumeration Which version of Xerces-C++ are you using? This sounds very much like the bug[1] that has been fixed in 3.0.0. [1] https://issues.apache.org/jira/browse/XERCESC-1441 Boris From boris at codesynthesis.com Thu Dec 20 04:18:10 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 20 03:31:10 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing In-Reply-To: References: Message-ID: Hi Brice, Ok, I think I figured it out. There are two issues. brice salva writes: > Server > > [...] > > > > > > > > > > > > [...] > > xml_schema::Qname(soapEnv::EnvelopeElement::namespace_(),"Server") Firstly, "Server" doesn't seem to be in the faultcodeEnum enumeration. Was it supposed to be "Sender"? The second issue is quite obscure. It boils down to how an unprefixed QName value is resolved in the context of a default namespace (as in your case). The choices are to treat it unqualified or to treat it as qualified with the default namespace. Apparently[1], the original XML Schema spec does not specify this so an errata was proposed where the qualified option were to be mandated. However, this errata[2] still appears to be open, probably because it would break existing schemas. I also couldn't find anything on this in the new XML Schema 1.1 spec. So, to put it bluntly, it is a mess, like a lot of things in XML Schema. Xerces-C++ happens to implements the unqualified option. Also, to me, this seems like a better choice since you can always "fix" the value to be qualified by simply using a prefix (not elegant but does the trick). In contrast, with the qualified interpretation there is no way to specify an unqualified name in the context of a default namespace. So in your case, I suggest that you use the "env:" prefix instead of the default namespace and forget all this as a bad dream ;-). [1] http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002JulSep/0037.html [2] http://www.w3.org/2001/05/xmlschema-rec-comments#pfiQName Boris From mjklaim at gmail.com Fri Dec 21 10:04:13 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Fri Dec 21 09:53:06 2012 Subject: [xsd-users] VS2012 Message-ID: Hi, Are there plans to provide VS2012 binaries/installer? Joel Lamotte From boris at codesynthesis.com Fri Dec 21 10:46:57 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Dec 21 10:45:21 2012 Subject: [xsd-users] VS2012 In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > Are there plans to provide VS2012 binaries/installer? Yes, in the next release of XSD (which is planed for the first quarter of 2013). Note that you should also be able to use XSD 3.3.0 with VS 2012. In XSD itslef there isn't anything that you need to build (libxsd is header- only). And for Xerces-C++ you can use VS 2010 projects (project/solution files for VS 2012 and 2010 are almost identical). Boris From mjklaim at gmail.com Fri Dec 21 13:12:44 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Fri Dec 21 13:01:36 2012 Subject: [xsd-users] VS2012 In-Reply-To: References: Message-ID: On Fri, Dec 21, 2012 at 4:46 PM, Boris Kolpackov wrote: > Note that you should also be able to use XSD 3.3.0 with VS 2012. In XSD > itslef there isn't anything that you need to build (libxsd is header- > only). And for Xerces-C++ you can use VS 2010 projects (project/solution > files for VS 2012 and 2010 are almost identical). > I'm using CMake, but indeed I just tried and my code seem to link. Joel Lamotte From salva.brice at gmail.com Mon Dec 31 07:52:01 2012 From: salva.brice at gmail.com (brice salva) Date: Mon Dec 31 07:39:56 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing In-Reply-To: References: Message-ID: Hi Boris, Many thanks for this complete clarification. As for the first point, indeed, it is a typo. Actually, my xml input file contains "Sender" and not "Server". Regarding the second point, I agree with you : using the "env:" prefix is the best and simplest workaround for now. Yet, with xsd codesynthesis, I cannot customize the default namespace prefix when I use the *element-type* and *element-map* parse/serialize methods to exchange xml messages (no properties as parameter). Is there any trick to do such a thing ? Once more, thanks. Brice On Thu, Dec 20, 2012 at 10:18 AM, Boris Kolpackov wrote: > Hi Brice, > > Ok, I think I figured it out. There are two issues. > > brice salva writes: > > > Server > > > > [...] > > > > > > > > > > > > > > > > > > > > > > > > [...] > > > > xml_schema::Qname(soapEnv::EnvelopeElement::namespace_(),"Server") > > Firstly, "Server" doesn't seem to be in the faultcodeEnum enumeration. > Was it supposed to be "Sender"? > > The second issue is quite obscure. It boils down to how an unprefixed > QName value is resolved in the context of a default namespace (as in > your case). The choices are to treat it unqualified or to treat it > as qualified with the default namespace. Apparently[1], the original > XML Schema spec does not specify this so an errata was proposed where > the qualified option were to be mandated. However, this errata[2] still > appears to be open, probably because it would break existing schemas. > I also couldn't find anything on this in the new XML Schema 1.1 spec. > So, to put it bluntly, it is a mess, like a lot of things in XML Schema. > > Xerces-C++ happens to implements the unqualified option. Also, to me, > this seems like a better choice since you can always "fix" the value > to be qualified by simply using a prefix (not elegant but does the > trick). In contrast, with the qualified interpretation there is no way > to specify an unqualified name in the context of a default namespace. > > So in your case, I suggest that you use the "env:" prefix instead of > the default namespace and forget all this as a bad dream ;-). > > [1] > http://lists.w3.org/Archives/Public/www-xml-schema-comments/2002JulSep/0037.html > [2] http://www.w3.org/2001/05/xmlschema-rec-comments#pfiQName > > Boris > From boris at codesynthesis.com Mon Dec 31 12:52:40 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Dec 31 12:39:33 2012 Subject: [xsd-users] Inconsistency in Qname serialization/parsing In-Reply-To: References: Message-ID: Hi Brice, brice salva writes: > Yet, with xsd codesynthesis, I cannot customize the default namespace > prefix when I use the *element-type* and *element-map* parse/serialize > methods to exchange xml messages (no properties as parameter). With element type/map you create the DOM document into which you will be serializing yourself which means that you will need to establish the namespace-prefix yourself as well. In your case, this should be as simple as adding the "env:" prefix to the name you pass as the second argument to createDocument() (see the 'messaging' example for a reference). You can also add other mappings by simply adding DOM attributes. Q 3.1, "How do I create an empty Xerces-C++ DOM document?" in the C++/Tree FAQ shows how to do this: http://wiki.codesynthesis.com/Tree/FAQ Boris