From boris at codesynthesis.com Mon Oct 1 02:18:19 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Importing element In-Reply-To: References: Message-ID: <20071001061819.GA11541@karelia> Hi Nicholas, Nicholas Yue writes: > XSD fails on parsing this line in my schema > > > > "Gsml.xsd: error: 'http://schemas.opengis.net/gml/3.1.1/base/gml.xsd' is > not a valid filesystem path" XSD does not support retrieving schemas from network locations. You will need to download gml.xsd (and all other schemas it pulls) and change the import directive in your schema to reference the local file, e.g., For notes on compiling GML schema with XSD, see the following Wiki page: http://wiki.codesynthesis.com/Schemas/GML Boris From boris at codesynthesis.com Mon Oct 1 02:33:47 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Importing element In-Reply-To: References: <20071001061819.GA11541@karelia> Message-ID: <20071001063347.GB11541@karelia> Hi Nicholas, In the future please keep your replies CC'ed to the xsd-users mailing list. This way a) other developers who may have experienced a similar problem can provide you with a solution b) questions and answers will be archived and available to others with similar problems. Nicholas Yue writes: > Thank you for the lightning fast reply. > > Are there plans to include the ability to retrieve schemas from network > locations? No, not at the moment. It is not that difficult technically. The problematic part is how to map URI to C++ #include directives. For local paths it is fairly straightforward. Also, I don't think anybody will keeps retrieving schemas from the remote location in the long run because every code regeneration will require network access and therefore take a lot longer compared to local files. GML, for example, contains 38 files. That means you will need at least 38 HTTP downloads (in reality quite a few more) for every source code regeneration. Boris From ganesh.borse at credit-suisse.com Mon Oct 1 03:46:17 2007 From: ganesh.borse at credit-suisse.com (Borse, Ganesh) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] request for guidance Message-ID: Hi, I am trying to create the following C++ class from the sample input XML given below. class orderCategory { pubilc: orderCategory(){}; orderCategory(int minOrderQty, float minOrderValue):_minQty(minOrderQty), _minValue(minOrderValue) { } bool isOrderSmall(int orderQty, float orderValue) { if ( (orderQty < _minQty) || (orderValue < _minValue){ return true; } return false; } private: int _minQty; flaot _minValue; }; The possible XML which I want to transform into this C++ class could be as below: SMALL ORDER isOrderSmall if((Qty < _minQty) OR (Value < _minValue)){ return true; } return false; (This XML document may not be very correct, as I am totally new to XML). Here, I am not trying to read the data stored in XML document. But, instead I'm trying to generate an independent class from XML which then can be used for totally different purpose than just reading the XML document. Can you please guide me, can we do this? If yes, how can we perform such transformation? Many thanks in advance for your kind help & guidance. Thanks, Ganesh ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== From boris at codesynthesis.com Mon Oct 1 05:31:45 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] request for guidance In-Reply-To: References: Message-ID: <20071001093145.GC11541@karelia> Hi Ganesh, Borse, Ganesh writes: > class orderCategory { > pubilc: > orderCategory(){}; > orderCategory(int minOrderQty, float minOrderValue):_minQty(minOrderQty), _minValue(minOrderValue) > { } > bool isOrderSmall(int orderQty, float orderValue) > { > if ( (orderQty < _minQty) || (orderValue < _minValue){ > return true; > } > return false; > } > private: > int _minQty; > flaot _minValue; > }; > > The possible XML which I want to transform into this C++ class could be > as below: > > > > SMALL ORDER > isOrderSmall > if((Qty < _minQty) OR (Value < _minValue)){ return true; } return false; > > > I am having a hard time finding any correspondence between the above class and XML fragment. > But, instead I'm trying to generate an independent class from XML > which then can be used for totally different purpose than just > reading the XML document. The C++/Tree mapping works the other way around: you give it your XML vocabulary specification (in XML Schema) and it generates you C++ classes (collectively called vocabulary object model) that you can use to read, access/modify, and write data stored in XML. The generated object model can be used for other purposes, for example binary serialization. You can also go a step further and customize the generated classes by adding your application- specific logic (for example the isOrderSmall() function from above). In this approach you will treat the generated C++ classes as base types (that simply provide data storage and XML reading/writing functionality) for your own classes which provide application-specific functionality. For more information on how to customize the object mode, see the 'contacts' example in the examples/cxx/tree/custom directory in the XSD distribution. This example adds the print() function to the generated class. For the general information on how to customize the generated code see the C++/Tree Mapping Customization Guide: http://wiki.codesynthesis.com/Tree/Customization_guide Alternatively, you can use the C++/Parser mapping. This mapping allows you to parser XML and build an object model from your own types. For an introduction to this mapping, see the C++/Parser Mapping Getting Started Guide: http://codesynthesis.com/projects/xsd/documentation/cxx/parser/guide/ Boris From boris at codesynthesis.com Tue Oct 2 06:13:43 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion In-Reply-To: <20070926181244.GG7763@karelia> References: <20070926150500.GE7763@karelia> <20070926181244.GG7763@karelia> Message-ID: <20071002101343.GB18935@karelia> Hi Ray, Boris Kolpackov writes: > Ray Lischner writes: > > > DOM-to-object model stage. Some of our schemas are predominantly > > strings. > > Ok, good. I am going to profile this and see if anything can be > optimized. I will get back to you with the results. I did some profiling of the DOM-to-object model stage in 3.0.0. I used an XML instance with the following fragment repeated for 300Kb: 42 42345.4232 aName123_45 2005-10-28T09:00:13.323257 bla bla bla3257 1st choice ENUM1 The test executable performs 1000 DOM-to-object parse iterations and is statically-linked so Xerces-C++, libstdc++, etc., are all counted in the results. Here is the top part of the oprofile output: CPU: AMD64 processors, speed 1793.09 MHz (estimated) samples % symbol name 35869 13.4132 xsd::cxx::xml::bits::char_transcoder::to(unsigned short const*, unsigned long) 19841 7.4196 _int_free 17425 6.5161 xsd::cxx::xml::qualified_name xsd::cxx::xml::dom::name(xercesc_2_8::DOMElement const&) 16646 6.2248 std::basic_string, std::allocator > xsd::cxx::tree::text_content(xercesc_2_8::DOMElement const&) 13952 5.2174 _int_malloc 13515 5.0539 std::string::compare(char const*) const 12593 4.7092 strlen 9303 3.4789 free 7600 2.8420 malloc 7046 2.6349 DummyBindingTest::parse(xsd::cxx::xml::dom::parser&, xsd::cxx::tree::flags) 6247 2.3361 malloc_consolidate 6146 2.2983 memset 6026 2.2534 std::num_get > >::_M_extract_float(std::istreambuf_iterator >, std::istreambuf_iterator >, std::ios_base&, std::_Ios_Iostate&, std::string&) const 5127 1.9172 xercesc_2_8::DOMElementImpl::getNodeType() const 5005 1.8716 __gnu_cxx::__exchange_and_add(int volatile*, int) 4752 1.7770 std::string::_Rep::_M_clone(std::allocator const&, unsigned long) 4517 1.6891 ____strtod_l_internal 4466 1.6701 memcpy 4335 1.6211 std::string::reserve(unsigned long) 3325 1.2434 operator new(unsigned long) 2939 1.0990 memchr 2930 1.0957 xercesc_2_8::DOMTextImpl::getNodeType() const 2890 1.0807 xsd::cxx::tree::token > > >::token(xercesc_2_8::DOMElement const&, xsd::cxx::tree::flags, xsd::cxx::tree::_type*) 2865 1.0714 std::string::append(unsigned long, char) The test parses the above 300Kb document in about 15ms. As you can see, the UTF-16 to UTF-8 conversion only takes 13% of the time. So even if we eliminate it completely, the overall speedup can't be by more than 13%. I did some optimizations in the top three functions (char_transcoder::to, xsd::cxx::xml::dom::name, and xsd::cxx::tree::text_content) and managed to squeeze 3ms (20% speedup) so the time now is about 12ms per document. Here is the oprofile output after the optimizations: samples % symbol name 27195 11.7552 xsd::cxx::xml::bits::char_transcoder::to(unsigned short const*, unsigned long) 16805 7.2640 xsd::cxx::xml::qualified_name xsd::cxx::xml::dom::name(xercesc_2_8::DOMElement const&) 15071 6.5145 std::string::compare(char const*) const 14168 6.1242 strlen 11409 4.9316 _int_free 9647 4.1700 _int_malloc 9421 4.0723 DummyBindingTest::parse(xsd::cxx::xml::dom::parser&, xsd::cxx::tree::flags) 9352 4.0424 std::basic_string, std::allocator > xsd::cxx::tree::text_content(xercesc_2_8::DOMElement const&) 6873 2.9709 free 6101 2.6372 malloc_consolidate 6069 2.6234 memset 5645 2.4401 std::num_get > >::_M_extract_float(std::istreambuf_iterator >, std::istreambuf_iterator >, std::ios_base&, std::_Ios_Iostate&, std::string&) const 5438 2.3506 xercesc_2_8::DOMElementImpl::getNodeType() const 4871 2.1055 malloc 4233 1.8297 std::locale::~locale() 4231 1.8289 ____strtod_l_internal 3383 1.4623 DummyEnumType::~DummyEnumType() 3351 1.4485 xsd::cxx::tree::string >::~string() 3023 1.3067 xercesc_2_8::DOMTextImpl::getLength() const 2961 1.2799 memchr 2895 1.2514 xercesc_2_8::DOMTextImpl::getNodeType() const 2830 1.2233 std::string::append(unsigned long, char) 2587 1.1182 std::string::reserve(unsigned long) 2418 1.0452 xercesc_2_8::DOMElementImpl::getNextSibling() const 2341 1.0119 __gnu_cxx::__exchange_and_add(int volatile*, int) The optimizations are for XSD 3.0.0 and will appear in the next release. I can also backport them to 2.3.1 if anybody is interested but cannot upgrade to 3.0.0. Boris From yue.nicholas at gmail.com Tue Oct 2 06:13:03 2007 From: yue.nicholas at gmail.com (Nicholas Yue) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema Message-ID: Hi, Is there a document which advices new user how to deal with publish scheme (not ones we generate)? I am on a bit of a learning curve with published schema as (1) they are external (2) they have other dependencies What are the best practices? When should I stop retrieving/downloading external dependencies (i.e. I am doing it the wrong way)? I am using Collada schema as a trial, I have read the wiki page but the instruction didn't allow me to complete the processing. Regards From boris at codesynthesis.com Tue Oct 2 06:41:26 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema In-Reply-To: References: Message-ID: <20071002104126.GA20312@karelia> Hi Nicholas, Nicholas Yue writes: > Is there a document which advices new user how to deal with publish > scheme (not ones we generate)? No, there is no such document. There shouldn't be any difference in most case: you simply download the schema(s), all their dependencies, if any, and compile them. If certain schemas require special treatment, then we normally add a page with instructions to the Wiki: http://wiki.codesynthesis.com/Schemas > When should I stop retrieving/downloading external dependencies > (i.e. I am doing it the wrong way)? You need to download all external dependencies and change import/include directives to reference local files. Some schemas (e.g., GML) even include external schema (normally xml.xsd, etc.) in their distributions. So check if a particular schema you are trying to use has an archive available with all the individual schema files and perhaps dependencies. > I am using Collada schema as a trial, I have read the wiki page but > the instruction didn't allow me to complete the processing. Last time I checked, COLLADA came as a single schema file with the only external dependency on xml.xsd which you can download from: http://www.w3.org/2001/xml.xsd Can you let us know what exactly is not working in your case? Boris From boris at codesynthesis.com Tue Oct 2 08:18:10 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Re: In-memory validation In-Reply-To: References: <20070926123333.GC7763@karelia> Message-ID: <20071002121810.GD20312@karelia> Hi David, We will try to implement as many features from the list below as possible for XSD 3.1.0 without changing the schedule. I also have some questions/comments below. david.r.moss@selex-comms.com writes: > * uniqueness i.e. can't add data that would break schema uniqueness > constraints. This will require a substantial amount of work while the feature is not very widely used. > * numeric ranges (e.g. min, max facets) > * string length and pattern facets The way to implement the pattern facet in a reasonable time-frame is to re-use the regex implementation from Xerces-C++. The problem is that the Xerces-C++ regex can only be used when Xerces-C++ is initialized. Not sure at the moment what can be done about this. > * list length (both min / max occurrence of an element in a sequence as > well as min / max items in a xsd list type) Are you using minOccurs/maxOccurs other than {0,1} for minOccurs and {1,unbounded} for maxOccurs? > * boolean This is already implemented: boolean is mapped to bool and C++ compiler won't allow you to assign to it any value other than true or false. > * date and time ranges - mapping to boost::date_time would help with this > i guess. We do not want to map date/time types to Boost types by default because this will add a non-optional dependency on Boost. It is quite easy, however, to achieve this mapping with type customization, as shown in the 'calendar' example in the examples/cxx/tree/custom/ directory. Instead, in the next version of XSD, we are going to map XML Schema date/time types to our own light-weight implementations. Boris From rlischner at proteus-technologies.com Tue Oct 2 09:32:41 2007 From: rlischner at proteus-technologies.com (Ray Lischner) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Poor performance of Unicode conversion References: <20070926150500.GE7763@karelia> <20070926181244.GG7763@karelia> <20071002101343.GB18935@karelia> Message-ID: > The test parses the above 300Kb document in about 15ms. As you can see, > the UTF-16 to UTF-8 conversion only takes 13% of the time. So even if we > eliminate it completely, the overall speedup can't be by more than 13%. One person's "only" is another person's "as much as". We see similar results, but from our point of view, if Xerces were miraculously, instantly changed to use UTF-8, that 13% would vanish instantly. It is pure waste. I realize that the waste is the result of a design decision by Xerces and entirely our of your control. > The optimizations are for XSD 3.0.0 and will appear in the next release. > I can also backport them to 2.3.1 if anybody is interested but cannot > upgrade to 3.0.0. Thanks, but because we've already modified the code base, I think merging your optimizations might be harder than switching to Xerces 2.8.0. From what I've read, I think Xerces 2.8.0 will give us the biggest benefit/effort right now. Thank you for your help. I see from the Xerces-C web site that we have you to thank for many of the Xerces 2.8.0 improvements, too. -- Ray Lischner, Proteus Technologies LLC From yue.nicholas at gmail.com Tue Oct 2 18:44:53 2007 From: yue.nicholas at gmail.com (Nicholas Yue) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema In-Reply-To: <20071002104126.GA20312@karelia> References: <20071002104126.GA20312@karelia> Message-ID: On 02/10/2007, Boris Kolpackov wrote: > > You need to download all external dependencies and change import/include > directives to reference local files. Some schemas (e.g., GML) even > include external schema (normally xml.xsd, etc.) in their distributions. > So check if a particular schema you are trying to use has an archive > available with all the individual schema files and perhaps dependencies. > > > I am using Collada schema as a trial, I have read the wiki page but > > the instruction didn't allow me to complete the processing. I am now successful in processing COLLADA's schema with XSD. Thank you. From boris at codesynthesis.com Wed Oct 3 02:46:54 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema In-Reply-To: References: <20071002104126.GA20312@karelia> Message-ID: <20071003064654.GA726@karelia> Hi Nicholas, Nicholas Yue writes: > I am now successful in processing COLLADA's schema with XSD. Can you be a bit more specific? Is the XSD compiler giving you an error? If so then can you show the error message to us? What version of COLLADA are you trying to compile? Boris From yue.nicholas at gmail.com Wed Oct 3 03:04:48 2007 From: yue.nicholas at gmail.com (Nicholas Yue) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema In-Reply-To: <20071003064654.GA726@karelia> References: <20071002104126.GA20312@karelia> <20071003064654.GA726@karelia> Message-ID: On 03/10/2007, Boris Kolpackov wrote: > > Hi Nicholas, > > Nicholas Yue writes: > > > I am now successful in processing COLLADA's schema with XSD. > > Can you be a bit more specific? Is the XSD compiler giving you > an error? If so then can you show the error message to us? What > version of COLLADA are you trying to compile? My "error" came from being new to schema processing. I had thought that external references to W3C do not need to be downloaded as it is a world wide published standard. I wrongly thought that only non W3C schema needed to be downloaded. Hence I download the copy of xml.xsd. I edited the Collada 1.4.1 schema to reference the local copy of xml.xsdand was able to generate the COLLADASchema.cxx and COLLADASchema.hxx file successfully. Other tools (JAXB and XMLBeans) have the concept of a catalog file to redirect external reference to local file so we don't need to edit the original schema file. Does XSD have the same tool concept? Is it also call catalog? Once again, thank you Boris. Regards From boris at codesynthesis.com Wed Oct 3 03:25:26 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Advice on working with published schema In-Reply-To: References: <20071002104126.GA20312@karelia> <20071003064654.GA726@karelia> Message-ID: <20071003072526.GB726@karelia> Hi Nicholas, Nicholas Yue writes: > Other tools (JAXB and XMLBeans) have the concept of a catalog file to > redirect external reference to local file so we don't need to edit the > original schema file. > > Does XSD have the same tool concept? No, XSD does not have such a feature but it shouldn't be difficult to implement. It is just that you are the first person who ever asked about something like this. I've added it to my TODO list. Boris From sbalasub at qualcomm.com Wed Oct 3 13:02:17 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XSD::choice Message-ID: Hi, I am looking for documentation or examples that shows the usage of xs:choice type. I have a choice type of two elements; looking at the generated code this is no different than two optional elements. If schema validation is turned off, does code synthesis allow both types to be populated? Or my question is, whose job is it to validate that only one of these types need to be populated. Thanks, Shiva From henry_c.ngu at lamrc.com Wed Oct 3 14:01:52 2007 From: henry_c.ngu at lamrc.com (Ngu, Henry C) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] (no subject) Message-ID: <252615686DDBA845977D9AF898D2F97709CE89E6@pdtcexchmbx03.fremont.lamrc.net> Hi all: I ran into problem trying to run XSD xsd cxx-parser --type-map E132-1-V0305-Schema.map E132-1-V0305-Schema.xsd with error E132CommonComponents-V0305-Schema.xsd:13:34: error: Attribute 'final' cannot appear in local complexType declarations. Is this attribute not supported ? I include here the 2 files for your info Appreciate your help Henry -------------- next part -------------- A non-text attachment was scrubbed... Name: E132-1-V0305-Schema.xsd Type: application/octet-stream Size: 19525 bytes Desc: E132-1-V0305-Schema.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20071003/52dcbe8e/E132-1-V0305-Schema.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: E132CommonComponents-V0305-Schema.xsd Type: application/octet-stream Size: 1865 bytes Desc: E132CommonComponents-V0305-Schema.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20071003/52dcbe8e/E132CommonComponents-V0305-Schema.obj From henry_c.ngu at lamrc.com Wed Oct 3 14:10:26 2007 From: henry_c.ngu at lamrc.com (Ngu, Henry C) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attribute 'final' cannot appear in local complexType declarations Message-ID: <252615686DDBA845977D9AF898D2F97709CE8A26@pdtcexchmbx03.fremont.lamrc.net> Hi all: This is a repost that I forgot the subject tile last time. I ran into problem trying to run XSD xsd cxx-parser --type-map E132-1-V0305-Schema.map E132-1-V0305-Schema.xsd Error encountered ------ E132CommonComponents-V0305-Schema.xsd:13:34: error: Attribute 'final' cannot appear in local complexType declarations. -------- Is this attribute not supported ? I include here the 2 files for your info Appreciate your help Henry From henry_c.ngu at lamrc.com Wed Oct 3 14:16:32 2007 From: henry_c.ngu at lamrc.com (Ngu, Henry C) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attribute 'final' cannot appear in local complexType declarations Message-ID: <252615686DDBA845977D9AF898D2F97709CE8A51@pdtcexchmbx03.fremont.lamrc.net> Hi all: This is a repost that I forgot to include the example files I ran into problem trying to run XSD xsd cxx-parser --type-map E132-1-V0305-Schema.map E132-1-V0305-Schema.xsd Error Encountered: ------------------ E132CommonComponents-V0305-Schema.xsd:13:34: error: Attribute 'final' cannot appear in local complexType declarations. ------------------ Is this attribute not supported? I include here the 2 files for your info Appreciate your help Henry -------------- next part -------------- A non-text attachment was scrubbed... Name: E132-1-V0305-Schema.xsd Type: application/octet-stream Size: 19525 bytes Desc: E132-1-V0305-Schema.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20071003/c081421f/E132-1-V0305-Schema.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: E132CommonComponents-V0305-Schema.xsd Type: application/octet-stream Size: 1865 bytes Desc: E132CommonComponents-V0305-Schema.xsd Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20071003/c081421f/E132CommonComponents-V0305-Schema.obj From boris at codesynthesis.com Wed Oct 3 14:13:22 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] XSD::choice In-Reply-To: References: Message-ID: <20071003181322.GB5315@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > I am looking for documentation or examples that shows the usage of > xs:choice type. As you have mentioned below, xs:choice itself does not have a representation in the generated code. Instead, elements inside choice are marked as optional. > I have a choice type of two elements; looking at the generated code this > is no different than two optional elements. > > If schema validation is turned off, does code synthesis allow both types > to be populated? Yes. The generated code contains only a minimal amount of checks that make sure the resulting object model is consistent (that is, your application won't crash when you try to access it). > Or my question is, whose job is it to validate that only one of these > types need to be populated. In the C++/Tree mapping, if your XML documents may be invalid, you need to turn on XML Schema validation. We are also working on a new hybrid mapping that will be similar to C++/Tree and will have XML Schema validation implemented in the generated code. Boris From boris at codesynthesis.com Wed Oct 3 14:23:23 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attribute 'final' cannot appear in local complexType declarations In-Reply-To: <252615686DDBA845977D9AF898D2F97709CE8A51@pdtcexchmbx03.fremont.lamrc.net> References: <252615686DDBA845977D9AF898D2F97709CE8A51@pdtcexchmbx03.fremont.lamrc.net> Message-ID: <20071003182323.GC5315@karelia> Hi Henry, Please don't post the same question several times. Ngu, Henry C writes: > E132CommonComponents-V0305-Schema.xsd:13:34: error: Attribute 'final' > cannot appear in local complexType declarations. Well, it is what the error says: attribute 'final' can only appear in a global complexType declaration (one with the name="" attribute) and therefore your schema is invalid. Remove the attribute and everything will work fine. I used the following command line to compile your schemas: xsd cxx-parser --namespace-map urn:semi-org:xsd.E132-1.V0305.auth=auth \ --namespace-map urn:semi-org:xsd.CommonComponents.V0305.ccs=ccs *.xsd Boris From henry_c.ngu at lamrc.com Wed Oct 3 19:19:48 2007 From: henry_c.ngu at lamrc.com (Ngu, Henry C) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attribute "final" error Message-ID: <252615686DDBA845977D9AF898D2F97709CE90B8@pdtcexchmbx03.fremont.lamrc.net> Thanks for the reply. But the same schemas worked without any error (no need to remove the attribute 'final') when I generated the code using a trial version of Liquid technology. Henry ---------------------------------------------------------- Ngu, Henry C > writes: > E132CommonComponents-V0305-Schema.xsd:13:34: error: Attribute 'final' > cannot appear in local complexType declarations. Well, it is what the error says: attribute 'final' can only appear in a global complexType declaration (one with the name="" attribute) and therefore your schema is invalid. Remove the attribute and everything will work fine. I used the following command line to compile your schemas: xsd cxx-parser --namespace-map urn:semi-org:xsd.E132-1.V0305.auth=auth \ --namespace-map urn:semi-org:xsd.CommonComponents.V0305.ccs=ccs *.xsd Boris From boris at codesynthesis.com Thu Oct 4 05:12:12 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Attribute "final" error In-Reply-To: <252615686DDBA845977D9AF898D2F97709CE90B8@pdtcexchmbx03.fremont.lamrc.net> References: <252615686DDBA845977D9AF898D2F97709CE90B8@pdtcexchmbx03.fremont.lamrc.net> Message-ID: <20071004091212.GA7684@karelia> Hi Henry, Ngu, Henry C writes: > But the same schemas worked without any error (no need to remove the > attribute 'final') when I generated the code using a trial version > of Liquid technology. That's because Liquid's product does not perform proper error checking. Here is a declaration for local complex type from the XML Schema specification, Part 1, Appendix A, "Schema for Schemas (normative)"[1]: As you can see, the use of the final attribute is prohibited. [1] http://www.w3.org/TR/xmlschema-1/#normative-schemaSchema Boris From rgoff at praxiseng.com Thu Oct 4 13:26:10 2007 From: rgoff at praxiseng.com (Roger Goff) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Problemswith hexBinary type in xsd-2.3.1 Message-ID: <9E8C2EE38A83804B8A7CD8F5C5D6BA9112CFEA@exch01.praxislan01.com> I am having a problem getting hex_binary types to serialize properly. I have a set of binary data represented as an unsigned char array. I create/use a hex_binary type as follows. I have an object from generated code myXMLObj that has a hexBinary field called hexField unsigned char dataBuf[2] = {0x30, ox82}; hex_binary hBin((void*)dataBuf, 2,2,false); myXMLObj->hexField(hBin); if(myXMLObj->hexField().present()) { char * myPtr = myXMLObj->hexField().get().data(); // this return 2 chars, 0x30, 0x82 string myString = myXMLObj->hexField().get().encode(); // I would expect the string "3082" but instead // returns a corrupt string "30" } Also, when I try to serialize the object using myXMLObj(std::cout ...) I get an invalid UTF-8 exception. I found some info in the archives from Jan 06 *** > How can I let the library to encode/decode the base64Binary elements? Or > should I use my own base64 encoder/decoder? At the moment we map base64Binary and hexBinary to strings. We neither decode nor encode the date stored in such strings. We didn't implement better support for binary data because there wasn't any interest in such a feature. I guess now there is ;-). If you would like I can implement proper binary support with encoding/ decoding and send it to you. This shouldn't take longer than a day. hth, *** I this the same issue, and if so, is there a fix available? The hex_binary types seems to work fine if I am encoding an ascii string, but I need to be able to process data from 0x00 to 0xFF, and I seem to be limited to the 0x00 to 0x7F range. any help is appreciated. thanks Roger From boris at codesynthesis.com Thu Oct 4 16:04:27 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Problemswith hexBinary type in xsd-2.3.1 In-Reply-To: <9E8C2EE38A83804B8A7CD8F5C5D6BA9112CFEA@exch01.praxislan01.com> References: <9E8C2EE38A83804B8A7CD8F5C5D6BA9112CFEA@exch01.praxislan01.com> Message-ID: <20071004200427.GD8482@karelia> Hi Roger, Roger Goff writes: > I am having a problem getting hex_binary types to serialize properly. There is a known bug in 2.3.1 in the hex_binary::encode() function which has been fixed in 3.0.0. There is also a patch available for 2.3.1: http://www.codesynthesis.com/~boris/tmp/xsd-2.3.1-hex-binary.patch Boris From Michael.Forstner at cpg.de Fri Oct 5 05:12:31 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Serialize ony a specific xml tag Message-ID: Hi all, is there an easy way with XSD Tree Mapping to serialize only one specific XML tag instead of the whole document? Thanks, Michael Forstner From boris at codesynthesis.com Fri Oct 5 05:29:16 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Serialize ony a specific xml tag In-Reply-To: References: Message-ID: <20071005092916.GA11713@karelia> Hi Michael, Forstner Michael writes: > is there an easy way with XSD Tree Mapping to serialize only one > specific XML tag instead of the whole document? There are two ways to do this: 1. If the element in question is defined globally in the schema then you can generate serialization functions for this element and use them to serialize it to XML. You may also want to pass the no_xml_declaration flag in order to get rid of XML declaration in the resulting output. The 'streaming' example in the examples/cxx/tree/ directory uses this approach. 2. If the element is local or you don't want to use serialization functions, then you can create a DOMDocument yourself with the desired root element, then serialize the data to DOMElement, and finally serialize the DOM document to XML text: using namespace xercesc; const type& r = ... // element data xml::dom::auto_ptr doc = create ("root", "http://www.compnay.com/namespace", "my"); DOMElement* e = doc->getDocumentElement (); *e << r; serialize (std::cout, *doc); In the above code fragment, create() and serialize() functions are from the C++/Tree Mapping FAQ questions 3.1 and 3.2: http://wiki.codesynthesis.com/Tree/FAQ Note also that you need to compile your schemas with the --generate-serialization option in order to get operator<< used in *e << r; Boris From dabee21 at gmail.com Sun Oct 7 14:24:37 2007 From: dabee21 at gmail.com (=?ISO-8859-2?Q?Miros=B3aw_Madej?=) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd problem Message-ID: <507fc4d50710071124g6f4d4073lab44fced17f909f6@mail.gmail.com> Hi I have file swx.xsd. I make cxx-tree mapping and I have swx.hxx and swx.cxx but when i try to use this sources in my program I have problems with parsing. Ofcourse I have only the *.xsd file and I havent any xml file coresponding to them. I thought that xsd serialization can make me my xml file from this schema definition. Can I do something like this?? If yes could you tell me how?? -- Mirek Madej From boris at codesynthesis.com Sun Oct 7 16:28:48 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] xsd problem In-Reply-To: <507fc4d50710071124g6f4d4073lab44fced17f909f6@mail.gmail.com> References: <507fc4d50710071124g6f4d4073lab44fced17f909f6@mail.gmail.com> Message-ID: <20071007202848.GC16909@karelia> Hi, Miros?aw Madej writes: > I have only the *.xsd file and I havent any xml file coresponding to > them. I thought that xsd serialization can make me my xml file from > this schema definition. No, it cannot. What you can do is create an object mode for some sample document in your program and then serialize it to XML. For more information on how to do this see Section 2.5, "Adding Serialization" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/ Boris From mhoffm1060 at aol.com Tue Oct 9 13:59:48 2007 From: mhoffm1060 at aol.com (mhoffm1060@aol.com) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Executable not being built Message-ID: <8C9D8B5511CB314-D0C-69F7@MBLK-M22.sysops.aol.com> I am building XSD 3.0.0 on Linux?from source code.? I have installed all the required packages. After I extract the XSD code, I run make in the xsd-3.0.0 directory. There are no errors during the build.? However there is no xsd executable ( that I can find.?? fine . -name "xsd" only finds the directories named xsd ). I then tried a make install.? There is no output during this command, however it is doing something.? When the command is finished I searched my system for xsd and it is still not there. Also I am doing this all as root. Am I missing something? ( I have built 2.3.1 successfully ) Thanks, Mark ________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com From boris at codesynthesis.com Tue Oct 9 14:37:43 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Executable not being built In-Reply-To: <8C9D8B5511CB314-D0C-69F7@MBLK-M22.sysops.aol.com> References: <8C9D8B5511CB314-D0C-69F7@MBLK-M22.sysops.aol.com> Message-ID: <20071009183743.GB27049@karelia> Hi Mark, mhoffm1060@aol.com writes: > There are no errors during the build.? However there is no xsd > executable. Can you try to cd to xsd (so that you are in xsd-3.0.0/xsd/) and run make there? If that does not print anything, can you try to add verbose=1 to the make command line? > ( I have built 2.3.1 successfully ) There hasn't been any substantial changes in the build system between 2.3.1 and 3.0.0 so I am surprised you can build 2.3.1 but not 3.0.0. Boris From mhoffm1060 at aol.com Tue Oct 9 15:45:57 2007 From: mhoffm1060 at aol.com (mhoffm1060@aol.com) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Executable not being built In-Reply-To: <20071009183743.GB27049@karelia> References: <8C9D8B5511CB314-D0C-69F7@MBLK-M22.sysops.aol.com> <20071009183743.GB27049@karelia> Message-ID: <8C9D8C425AD3096-D0C-7263@MBLK-M22.sysops.aol.com> Hey Boris, >Hi Mark, >mhoffm1060@aol.com writes: >> There are no errors during the build.? However there is no xsd >> executable. >Can you try to cd to xsd (so that you are in xsd-3.0.0/xsd/) and >run make there? If that does not print anything, can you try to >add verbose=1 to the make command line? I got no rule to make ...boost_1_34_1/stage/lib/libboost_regex-gcc-1_34_1.so ( There is a ...regex_gcc41-... in this directory ). I created a link from _regex-gcc to _regex-gcc41 and this worked. I had to do this for the boost_filesystem? library for one of the required libraries. I discovered this because the build?did display the no rule to make error during that?build.? >> ( I have built 2.3.1 successfully ) >There hasn't been any substantial changes in the build system >between 2.3.1 and 3.0.0 so I am surprised you can build 2.3.1 >but not 3.0.0. I should have mentioned that I upgraded all the required libraries also. Sorry about that. >Boris Thanks, Mark ________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com From boris at codesynthesis.com Tue Oct 9 16:37:49 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Executable not being built In-Reply-To: <8C9D8C425AD3096-D0C-7263@MBLK-M22.sysops.aol.com> References: <8C9D8B5511CB314-D0C-69F7@MBLK-M22.sysops.aol.com> <20071009183743.GB27049@karelia> <8C9D8C425AD3096-D0C-7263@MBLK-M22.sysops.aol.com> Message-ID: <20071009203749.GC27049@karelia> Hi Mark, mhoffm1060@aol.com writes: > I got no rule to make ...boost_1_34_1/stage/lib/libboost_regex-gcc-1_34_1.so > > ( There is a ...regex_gcc41-... in this directory ). Yes, this is a known problem. Boost folks have changed the naming scheme of their libraries again. Next version of XSD will have the necessary smarts to work with that. Make didn't show this error message when you run from the xsd-3.0.0 source root due to a bug in make. Hopefully it will be fixed in the next release of GNU make. Boris From Tim.Parker at intecbilling.com Tue Oct 16 05:25:11 2007 From: Tim.Parker at intecbilling.com (Tim Parker) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Query about using Binary in-memory format to pass between applications Message-ID: <01126BA7912E5F42807CF2F7909549AA22B01C@ibwokex01p.intecbilling.com> Hi, I am new to this group so apologies if this has already been asked but I would like to know if the in-memory representation of XML data can be written to a file or streamed to another application and if so is this format an internal one or is it up to the developer to build this? Basically we are looking for a way to use XML to represent data but due to the volumes it is not practical to pass data around in an XML format due to the size and the processing overhead of parsing the XML data each time but if we can convert the XML to a binary representation this would remove the processing overhead and hopefully reduce the size of the XML data packets. Thanks for any info/help anyone can provide with this. Regards Tim. This e-mail and any attachments are confidential and may also be legally privileged and/or copyright material of Intec Telecom Systems PLC (or its affiliated companies). If you are not an intended or authorised recipient of this e-mail or have received it in error, please delete it immediately and notify the sender by e-mail. In such a case, reading, reproducing, printing or further dissemination of this e-mail or its contents is strictly prohibited and may be unlawful. Intec Telecom Systems PLC does not represent or warrant that an attachment hereto is free from computer viruses or other defects. The opinions expressed in this e-mail and any attachments may be those of the author and are not necessarily those of Intec Telecom Systems PLC. Intec Telecom Systems PLC Registered in England No 317 9314 Registered Office: Wells Court 2 Albert Drive Woking Surrey GU21 5UB From boris at codesynthesis.com Tue Oct 16 05:36:59 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] Query about using Binary in-memory format to pass between applications In-Reply-To: <01126BA7912E5F42807CF2F7909549AA22B01C@ibwokex01p.intecbilling.com> References: <01126BA7912E5F42807CF2F7909549AA22B01C@ibwokex01p.intecbilling.com> Message-ID: <20071016093659.GC31084@karelia> Hi Tim, Tim Parker writes: > I am new to this group so apologies if this has already been asked but I > would like to know if the in-memory representation of XML data can be > written to a file or streamed to another application and if so is this > format an internal one or is it up to the developer to build this? You can use the binary serialization/extraction feature which allows you two write/read the in-memory representation to/from data representation streams. This feature is designed in an open-ended way which allows you to plug in your own data formats by simply providing serialization/extraction code for basic types (e.g., int, string, etc). There is also a number of commonly used data representation formats supported out of the box (that is, the XSD runtime provided the serialization/extraction code for basic types for these formats). These include CDR (uses ACE CDR streams) and XDR (uses Sun's XDR interface). There is the 'binary' example in the examples/cxx/tree/ directory that shows how to read/write the in-memory representation from/to binary representation using ACE CDR streams. An example for XDR will be included in the next release of XSD. If you would like I can provide one for the current version. There is also the sample code for supporting Boost archives that was contributed by one of XSD users but is not yet part of the XSD distribution. > Basically we are looking for a way to use XML to represent data but due > to the volumes it is not practical to pass data around in an XML format > due to the size and the processing overhead of parsing the XML data each > time but if we can convert the XML to a binary representation this would > remove the processing overhead and hopefully reduce the size of the XML > data packets. Yes, you can definitely do that. In fact, quite a few people are using binary serialization in exactly the same way and for exactly the same reasons. Boris From fboel at procos.nl Thu Oct 18 03:10:11 2007 From: fboel at procos.nl (Frits Boel) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] parse x-www-form-urlencoded xml Message-ID: <88F92DBEC5C4DF4FA0D07B1C0465767A1692C7@pc108> Is it possible to parse x-www-form-urlencoded xml with the C++/Tree tool? Thanks in advance, Frits Boel From boris at codesynthesis.com Thu Oct 18 03:48:02 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] parse x-www-form-urlencoded xml In-Reply-To: <88F92DBEC5C4DF4FA0D07B1C0465767A1692C7@pc108> References: <88F92DBEC5C4DF4FA0D07B1C0465767A1692C7@pc108> Message-ID: <20071018074802.GA11146@karelia> Hi Frits, Frits Boel writes: > Is it possible to parse x-www-form-urlencoded xml with the C++/Tree > tool? I am not sure what you mean by "x-www-form-urlencoded xml". My understanding is that x-www-form-urlencoded is a method of encoding name-value pairs that are submitted by HTML forms. As such, x-www-form-urlencoded data is not really XML. Can you maybe explain the main differences between x-www-form-urlencoded XML and plain XML? Boris From henry_c.ngu at lamrc.com Fri Oct 19 18:51:37 2007 From: henry_c.ngu at lamrc.com (Ngu, Henry C) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] How to serialize the xsd schema to output Soap protocol Message-ID: <252615686DDBA845977D9AF898D2F9770A057FFB@pdtcexchmbx03.fremont.lamrc.net> Hi: Being new to the Soap serializer and Schema, I have question regarding how to apply the class generated from XSD files. From *.cxx and *.hxx where I had 2 classes class E132HeaderType_pskel: public virtual ::xml_schema::complex_content class EstablishSessionRequestType_pskel: public virtual ::xml_schema::complex_content How do I apply the above classes to the header and body, so that I don't need to write each line of serializer code as below ? void CallECCEEstablishSession(_bstr_t from, _bstr_t to) { ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // Connect to the service Connector.CreateInstance(__uuidof(HttpConnector30)); Connector->Property["EndPointURL"] = "http://a118661:8079/SessionManager"; Connector->Connect(); // Begin message Connector->Property["SoapAction"] = "urn:semi-org:ws.E132-1.V0305.SessionManagerBinding:EstablishSession"; Connector->BeginMessage(); // Create the SoapSerializer Serializer.CreateInstance(__uuidof(SoapSerializer30)); // Connect the serializer to the input stream of the connector Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); Serializer->StartEnvelope("","",""); Serializer->StartHeader(""); Serializer->StartElement("E132Header","urn:semi-org:xsd.E132-1.V0305.aut h","",""); Serializer->StartElement("SessionID","urn:semi-org:xsd.E132-1.V0305.auth ","",""); Serializer->WriteString(""); Serializer->EndElement(); Serializer->StartElement("From","urn:semi-org:xsd.E132-1.V0305.auth","", ""); Serializer->WriteString(from); Serializer->EndElement(); Serializer->StartElement("To","urn:semi-org:xsd.E132-1.V0305.auth","","" ); Serializer->WriteString(to); Serializer->EndElement(); Serializer->EndElement(); Serializer->EndHeader(); Serializer->StartBody(""); Serializer->StartElement("EstablishSessionRequest","urn:semi-org:xsd.E13 2-1.V0305.auth","",""); Serializer->StartElement("EndPoint","urn:semi-org:xsd.E132-1.V0305.auth" ,"",""); Serializer->StartElement("HTTPEndPoint","urn:semi-org:xsd.E132-1.V0305.a uth","",""); Serializer->StartElement("URL","urn:semi-org:xsd.E132-1.V0305.auth",""," "); Serializer->WriteString("http://A118661/ECCEConsumer/ECCEConsumerService .asmx"); Serializer->EndElement(); Serializer->EndElement(); Serializer->EndElement(); Serializer->EndElement(); Serializer->EndBody(); Serializer->EndEnvelope(); // Send the message to the web service Connector->EndMessage(); } Thanks Henry From boris at codesynthesis.com Mon Oct 22 11:45:02 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:58 2009 Subject: [xsd-users] How to serialize the xsd schema to output Soap protocol In-Reply-To: <252615686DDBA845977D9AF898D2F9770A057FFB@pdtcexchmbx03.fremont.lamrc.net> References: <252615686DDBA845977D9AF898D2F9770A057FFB@pdtcexchmbx03.fremont.lamrc.net> Message-ID: <20071022154502.GA8418@karelia> Hi Henry, Ngu, Henry C writes: > Being new to the Soap serializer and Schema, I have question > regarding how to apply the class generated from XSD files. > > From *.cxx and *.hxx where I had 2 classes > > class E132HeaderType_pskel: public virtual ::xml_schema::complex_content > > class EstablishSessionRequestType_pskel: public virtual > ::xml_schema::complex_content > > > How do I apply the above classes to the header and body, so that I don't > need to write each line of serializer code as below ? The classes that you have generated using the C++/Parser mapping are parser skeletons and are only capable of parsing XML, not creating it. Right now we are working on the complementary mapping, C++/Serializer, that will provide XML serialization in a way similar to C++/Parser. However, this mapping will first appear in XSD/e (our embedded/mobile systems offering) and only then in XSD. Alternatively, you can use the C++/Tree mapping which supports both parsing and serialization. Boris From s.mangelsdorf at gmail.com Mon Oct 22 21:10:53 2007 From: s.mangelsdorf at gmail.com (Shaun Mangelsdorf) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] XSD 2.3.1 export symbols problem with MSVC 8.0 Message-ID: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> Hi xsd-users, I'm in the process at the moment of porting the SAML2 library from esoeproject.org to compile as a Win32 .DLL file. I am stuck with XSD 2.3.1at the moment, but if this is an issue that 3.0 will fix I could look into refactoring the code to work with the newer version. The commands we are currently using to generate the cxx-tree code is as follows: $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include "saml2/SAML2Defs.h"' --char-type wchar_t --generate-xml-schema --custom-type date --custom-type dateTime --hxx-epilogue '#include "saml2/xsd/xml- schema-custom.h"' --output-dir $(SAML2PATH)/include/saml2/xsd/ xml-schema.xsd $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include "saml2/SAML2Defs.h"' --extern-xml-schema saml2/xsd/xml- schema.xsd--generate-default-ctor --morph-anonymous --char-type wchar_t --generate-polymorphic --generate-serialization --namespace-map http://www.w3.org/2001/04/xmlenc#=w3::xmlenc --namespace-map http://www.w3.org/2000/09/xmldsig#=w3::xmldsig--namespace-map urn:oasis:names:tc:SAML: 2.0:assertion=saml2::assertion --namespace-map urn:oasis:names:tc:SAML: 2.0:metadata=saml2::metadata --namespace-map urn:oasis:names:tc:SAML: 2.0:protocol=saml2::protocol --output-dir ./src-gen/ $(SAML2PATH)/schema/* $(XSD) cxx-tree --export-symbol SAML2EXPORT --hxx-prologue '#include "saml2/SAML2Defs.h"' --extern-xml-schema saml2/xsd/xml- schema.xsd--custom-type AttributeValueType --hxx-epilogue '#include "saml2/xsd/xml- schema-custom-attributevaluetype.h"' --generate-default-ctor --morph-anonymous --char-type wchar_t --show-sloc --generate-polymorphic --generate-serialization --namespace-map http://www.w3.org/2001/04/xmlenc#=w3::xmlenc --namespace-map http://www.w3.org/2000/09/xmldsig#=w3::xmldsig --namespace-map urn:oasis:names:tc:SAML:2.0:assertion=saml2::assertion--namespace-map urn:oasis:names:tc:SAML: 2.0:metadata=saml2::metadata --namespace-map urn:oasis:names:tc:SAML: 2.0:protocol=saml2::protocol --output-dir ./src-gen/ $(SAML2PATH)/schema/lxacml- schema-context.xsd In the case of building the library saml2/SAML2Defs.h defines the SAML2EXPORT symbol to: Win32: __declspec(dllexport) GNU G++: __attribute((visibility("default"))) (Note: on G++ I am compiling with -fvisibility=hidden but that is beside the point) The G++ compilation on linux and windows (mingw32) succeeds perfectly, but on MS Visual C++ (8.0, express edition) I get a list of compiler errors. The most significant lines are: c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(97) : error C2064: term does not evaluate to a function taking 2 arguments c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(94) : while compiling class template member function 'xsd::cxx::tree::buffer &xsd::cxx::tree::buffer::operator =(const xsd::cxx::tree::buffer &)' with [ C=wchar_t ] c:\xsd\libxsd\xsd\cxx\tree\types.hxx(1268) : see reference to class template instantiation 'xsd::cxx::tree::buffer' being compiled with [ C=wchar_t ] z:\workspaces\esoe\saml2cpp\include\saml2\bindings\xmldsig- core-schema.hxx(92) : see reference to class template instantiation 'xsd::cxx::tree::base64_binary' being compiled with [ C=wchar_t, B=xml_schema::simple_type ] c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : error C2248: 'xsd::cxx::tree::uri::uri' : cannot access protected member declared in class 'xsd::cxx::tree::uri' with [ C=wchar_t, B=xml_schema::simple_type ] c:\xsd\libxsd\xsd\cxx\tree\types.hxx(1188) : see declaration of 'xsd::cxx::tree::uri::uri' with [ C=wchar_t, B=xml_schema::simple_type ] c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : while compiling class template member function 'xsd::cxx::tree::sequence::sequence(xsd::cxx::tree::sequence::size_type)' with [ X=saml2::assertion::AudienceRestrictionType::Audience::type ] z:\workspaces\esoe\saml2cpp\include\saml2\bindings\saml- schema-assertion-2.0.hxx(1437) : see reference to class template instantiation 'xsd::cxx::tree::sequence' being compiled with [ X=saml2::assertion::AudienceRestrictionType::Audience::type ] (apologies for the length of the paste, MSVC++ has some lengthy output.) Full build output is at http://xsd.pastebin.com/m477292bb until 22 Nov 07. I have tried changing the export symbol argument to: --export-symbol '__declspec(dllexport)' and have also tried removing the --hxx-prologue with that export symbol included, and I have had no success getting it to build. Removing the --export-symbol flag entirely fixes it (with obvious bad side effects), even if the --hxx-prologue flag to include SAML2Defs.h is still present. Any idea what steps I could take to resolve this? Some links that might help: Schemas: http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Fschema%2F#_branches_development_saml2cpp_schema_ *.hxx: http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Finclude%2Fsaml2%2Fbindings%2F#_branches_development_saml2cpp_include_saml2_bindings_ *.cxx: http://svn.intient.com/websvn/listing.php?repname=esoe&path=%2Fbranches%2Fdevelopment%2Fsaml2cpp%2Fsrc%2Fsaml2%2Fbindings%2F#_branches_development_saml2cpp_src_saml2_bindings_ Thanks, Shaun Mangelsdorf From s.mangelsdorf at gmail.com Tue Oct 23 07:16:42 2007 From: s.mangelsdorf at gmail.com (Shaun Mangelsdorf) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Re: XSD 2.3.1 export symbols problem with MSVC 8.0 In-Reply-To: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> References: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> Message-ID: <90ad28f40710230416u5bcf9fa6r6d018eb8f874c550@mail.gmail.com> Hi again xsd-users, Just following up what I wrote earlier, I have made some progress on getting my code to compile. c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(97) : error C2064: term does not > evaluate to a function taking 2 arguments After taking a look at this file, I changed the line from: capacity_ (other.capacity_, false); to: capacity (other.capacity_, false); and this compilation error went away. I then checked XSD 3.0.0 and noticed that this is already changed in this version, so perhaps this is a known and fixed bug :) c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : error C2248: > 'xsd::cxx::tree::uri::uri' : cannot access protected member Perhaps an obvious fix here, I changed the visibility on the default constructor for xsd::cxx::tree::uri ( types.hxx:1187) to public. Got rid of the error message but this still leads me to think there is a problem with the way this is being used. What I have discovered is that (as an example) for the SAML2 element, the following typedefs are created: public: struct Audience { typedef ::xml_schema::uri type; typedef ::xsd::cxx::tree::traits< type, wchar_t > traits; typedef ::xsd::cxx::tree::sequence< type > container; typedef container::iterator iterator; typedef container::const_iterator const_iterator; }; My xml_schema file, generated in the first step of my commands that I pasted, has the following typedef for uri: typedef ::xsd::cxx::tree::uri< wchar_t, simple_type > uri; So what I'm seeing here is that the "container" typedef is effectively: xsd::cxx::tree::sequence< xsd::cxx::tree::uri > When that is instantiated (I can't find a direct reference here, but this is what the compiler is complaining about) the following constructor is referenced: explicit sequence (size_type n) : sequence_common (n, X ()) { } with X=xsd::cxx::tree::uri I believe this is where it chokes, since X() is not visible. My theory is that G++ doesn't see it because it's never used, and so it's not compiled, but MSVC compiles the whole template class. This is just a theory however. I can't see a way to resolve this without modifying the libxsd code to expose the uri() constructor publicly. Any thoughts or ideas? Thanks, Shaun Mangelsdorf From boris at codesynthesis.com Tue Oct 23 10:12:10 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Re: XSD 2.3.1 export symbols problem with MSVC 8.0 In-Reply-To: <90ad28f40710230416u5bcf9fa6r6d018eb8f874c550@mail.gmail.com> References: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> <90ad28f40710230416u5bcf9fa6r6d018eb8f874c550@mail.gmail.com> Message-ID: <20071023141210.GC12710@karelia> Hi Shaun, Shaun Mangelsdorf writes: > c:\xsd\libxsd\xsd\cxx\tree\buffer.txx(97) : error C2064: term does not > evaluate to a function taking 2 arguments > > After taking a look at this file, I changed the line from: > capacity_ (other.capacity_, false); > to: > capacity (other.capacity_, false); > and this compilation error went away. > > I then checked XSD 3.0.0 and noticed that this is already changed in this > version, so perhaps this is a known and fixed bug :) Yes, this is a know bug that has been fixed in 3.0.0. > c:\xsd\libxsd\xsd\cxx\tree\containers.hxx(932) : error C2248: > 'xsd::cxx::tree::uri::uri' : cannot access protected member > > Perhaps an obvious fix here, I changed the visibility on the default > constructor for xsd::cxx::tree::uri ( types.hxx:1187) to public. Got rid of > the error message but this still leads me to think there is a problem with > the way this is being used. Yes, this is not an ideal fix. A better one would probably be to merge the two constructors (this and the next one) in containers to be: sequence (size_type n, const X& x = X ()) : sequence_common (n, x) { } It used to be like this but then it caused problems on IBM XL C++[1]. Could you make the above change and let me know if it helps? If it does, then I can add some macro hackery to make it work on both VC++ and XL C++. > My theory is that G++ doesn't see it because it's never used, and so > it's not compiled, but MSVC compiles the whole template class. I think I know what happens: when you export a type, VC++ for some (perhaps valid, from its DLL architecture point of view) reason instantiates things that aren't directly used. That's why when you remove the DLL export macro, everything compiles. Of course, this is a violation of the C++ Standard which says that only functions that are used should be instantiated. Thanks for reporting this! Boris [1] http://codesynthesis.com/~boris/blog/2006/12/06/default-argument-or-overloading/ From s.mangelsdorf at gmail.com Tue Oct 23 15:59:59 2007 From: s.mangelsdorf at gmail.com (Shaun Mangelsdorf) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Re: XSD 2.3.1 export symbols problem with MSVC 8.0 In-Reply-To: <90ad28f40710231256p21a4e9d5m828e4f001f8cb20b@mail.gmail.com> References: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> <90ad28f40710230416u5bcf9fa6r6d018eb8f874c550@mail.gmail.com> <20071023141210.GC12710@karelia> <90ad28f40710231256p21a4e9d5m828e4f001f8cb20b@mail.gmail.com> Message-ID: <90ad28f40710231259s33ceb751v19ae88506e67a484@mail.gmail.com> Apologies.. For some reason Gmail decided to reply off list by default. > Hi Boris, > > > > > sequence (size_type n, const X& x = X ()) > > : sequence_common (n, x) > > { > > } > > Worked like a charm. I also needed to do the same in 2 other places, > overall diff attached. > > > > > My theory is that G++ doesn't see it because it's never used, and so > > > it's not compiled, but MSVC compiles the whole template class. > > > > I think I know what happens: when you export a type, VC++ for some > > (perhaps valid, from its DLL architecture point of view) reason > > instantiates things that aren't directly used. That's why when > > you remove the DLL export macro, everything compiles. Of course, > > this is a violation of the C++ Standard which says that only > > functions that are used should be instantiated. > > > > Thanks for reporting this! > > > > Boris > > > > [1] http://codesynthesis.com/~boris/blog/2006/12/06/default-argument-or-overloading/ > > > > Very interesting the way compilers handle certain things differently.. > Thanks for the insight. > > > > Thanks, > Shaun Mangelsdorf > > From Michael.Forstner at cpg.de Wed Oct 24 06:26:02 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Merge XSD files Message-ID: Hi all, I am using XSD with C++ tree option with 3 different XSD files. Some common types are defined in one XSD file, others are defined in two or more XSD files. The multiple defined types are exactly identical, but I have to define a different namespace for each XSD file, otherwise I get (of course) compiler errors with multiple defined symbols. Is there a way to merge the XSD files and eleminating the multiple defined types? Thanks and regards, Michael Forstner From boris at codesynthesis.com Wed Oct 24 06:47:02 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Merge XSD files In-Reply-To: References: Message-ID: <20071024104702.GC26904@karelia> Hi Michael, Forstner Michael writes: > Is there a way to merge the XSD files and eleminating the multiple > defined types? The right approach to this problem is to factor out common types into a separate schema file and then xsd:include it into schemas that depend on these common types. There is no "magic" way to do this in XSD automatically. Boris From boris at codesynthesis.com Wed Oct 24 12:28:30 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Re: XSD 2.3.1 export symbols problem with MSVC 8.0 In-Reply-To: <90ad28f40710231259s33ceb751v19ae88506e67a484@mail.gmail.com> References: <90ad28f40710221810r223ff008n2b9f91724bacf9ca@mail.gmail.com> <90ad28f40710230416u5bcf9fa6r6d018eb8f874c550@mail.gmail.com> <20071023141210.GC12710@karelia> <90ad28f40710231256p21a4e9d5m828e4f001f8cb20b@mail.gmail.com> <90ad28f40710231259s33ceb751v19ae88506e67a484@mail.gmail.com> Message-ID: <20071024162830.GB861@karelia> Hi Shaun, Shaun Mangelsdorf writes: > Worked like a charm. I also needed to do the same in 2 other places, > overall diff attached. The patch looks good except that you dropped the explicit keyword. I've incorporated it to be in effect when compiling with VC++. The change will appear in the upcoming 3.1.0. Thanks, Boris From sbalasub at qualcomm.com Fri Oct 26 14:13:24 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Schema Validation Message-ID: Hi, Is there a document or guidelines for supporting schema validation using Code Synthesis. Here are some of the options that I see. 1. Use xerces for validation and then code synthesis for XML de-serialization only 2. Use Code Synthesis with schema validation that would require schema files. 3. Use Code Synthesis with schema validation that would not require schemas but instead use the generated code to validate the document I am hoping to not have to do step 1 but rely on Code Synthesis to perform schema validation. If we are asked to use step 2, then what is the recommended way of provide the schema location and the url for the schema? Another question is, if there is any difference between 1 and 2. Your help is much appreciated in advance. Thanks, Shiva From boris at codesynthesis.com Fri Oct 26 15:37:07 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Schema Validation In-Reply-To: References: Message-ID: <20071026193707.GB29001@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > Is there a document or guidelines for supporting schema validation using > Code Synthesis. For the C++/Tree mapping: 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 For the C++/Parser mapping: Section 5.3, "XML Schema Validation" in the C++/Parser Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/parser/guide/#5.3 > Here are some of the options that I see. > > 1. Use xerces for validation and then code synthesis for XML > de-serialization only What you probably mean here is to perform XML-to-DOM stage yourself (with enabled validation) and then use the DOM document as input to the C++/Tree generated parsing functions. You only need to use this approach if you want to pre-parse and/or cache the schemas, as discussed in Section 5.1 mentioned above. > 2. Use Code Synthesis with schema validation that would require > schema files. This is the most commonly used approach and is discussed in detail in Section 5.1. > 3. Use Code Synthesis with schema validation that would not require > schemas but instead use the generated code to validate the document The C++/Tree mapping provides only minimal support for XML Schema validation in the generated code. C++/Parser, on the other hand, support validation in the generated code of a commonly-used subset of XML Schema. See Section 5.3 mentioned above for details. We are also working on a new hybrid mapping which will be similar to C++/Tree and will support validation in the generated code for both parsing and serialization. > If we are asked to use step 2, then what is the recommended way of > provide the schema location and the url for the schema? This is covered in detail in Section 5.1, "XML Schema Validation and Searching" mentioned above. > Another question is, if there is any difference between 1 and 2. With option 1 you have more ability to customize the validation parameters. Option 2 is simply the most commonly used setup. Boris From sbalasub at qualcomm.com Fri Oct 26 16:47:57 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Schema Validation In-Reply-To: <20071026193707.GB29001@karelia> References: <20071026193707.GB29001@karelia> Message-ID: > 2. Use Code Synthesis with schema validation that would require > schema files. This is the most commonly used approach and is discussed in detail in Section 5.1. Boris, I would prefer this for now. However, I have one additional question. Let's say, I have the schemas in /opt/schemas/namespace1/namespace2/schemafile1.xsd /opt/schemas/namespace1/namespace2/schemafile2.xsd And the XML document contains http://someurl/namespace1/namespace2/schemafile1.xsd How do I pass this information to xsd/tree parser? One way is, 1. schemafilepath = full schema path - "http://url/" 2. absolutepath = /opt/schemas + schemafilepath. Is there another easier way to specify that the root schema location is X. Find the schema in the location? Thanks, Shiva From boris at codesynthesis.com Fri Oct 26 17:01:30 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Schema Validation In-Reply-To: References: <20071026193707.GB29001@karelia> Message-ID: <20071026210130.GC29001@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > Let's say, I have the schemas in > > /opt/schemas/namespace1/namespace2/schemafile1.xsd > > /opt/schemas/namespace1/namespace2/schemafile2.xsd > > And the XML document contains > http://someurl/namespace1/namespace2/schemafile1.xsd > > How do I pass this information to xsd/tree parser? Let's say schemafile1.xsd is in the http://www.example.com/namespace1 namespace and schemafile2.xsd is in http://www.example.com/namespace2. Then you can do the following: xml_schema::properties props; props.schema_location ( "http://www.example.com/namespace1", "file:////opt/schemas/namespace1/namespace2/schemafile1.xsd"); props.schema_location ( "http://www.example.com/namespace2", "file:////opt/schemas/namespace1/namespace2/schemafile2.xsd"); root ("file.xml", 0, props); Here 'root' is the parser function for the document root. Note that the above schema location properties override the schema location information specified in the XML documents. Boris From gail.nagle at baesystems.com Fri Oct 26 23:13:08 2007 From: gail.nagle at baesystems.com (Nagle, Gail A (US SSA)) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] GML 3.1.1 basicTypes.hxx class doubleList Message-ID: Can anyone provide an example of how to traverse an object of type doubleList produced when the xsd cxx-tree generates code for the basicTypes.xsd file? The full class declaration is shown below. Sorry, but I cannot figure out what a :xsd::cxx::tree::list<> is! Thank you, Gail class doubleList: public ::xml_schema::simple_type, public ::xsd::cxx::tree::list< ::xml_schema::double_, char > { public: doubleList (); doubleList (const ::xercesc::DOMElement& e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); doubleList (const ::xercesc::DOMAttr& a, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); doubleList (const ::std::string& s, const ::xercesc::DOMElement* e, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); doubleList (const doubleList& x, ::xml_schema::flags f = 0, ::xml_schema::type* c = 0); virtual doubleList* _clone (::xml_schema::flags f = 0, ::xml_schema::type* c = 0) const; }; From boris at codesynthesis.com Sat Oct 27 13:17:56 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] GML 3.1.1 basicTypes.hxx class doubleList In-Reply-To: References: Message-ID: <20071027171756.GA10492@karelia> Hi Gail, Nagle, Gail A (US SSA) writes: > Can anyone provide an example of how to traverse an object of type > doubleList produced when the xsd cxx-tree generates code for the > basicTypes.xsd file? Here is the definition of doubleList taken from basicTypes.xsd: The generated doubleList C++ class has an interface of a standard sequence. Practically, this means that you can treat it like std::vector: doubleList& dl = ... for (doubleList::iterator i = dl.begin (); i != dl.end (); ++i) { double v = *i; cout << v << endl; } dl.push_back (1.1); dl.push_back (1.2); Generally, if you don't know how to use C++ mapping for a particular XML Schema construct, the fastest way to find out is to look this Schema construct up in the C++/Tree Mapping User Manual. For example, mapping for simple type derivation by list is covered in Section 2.6.3, "Mapping for Derivation by List": http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.6.3 Boris From gail.nagle at baesystems.com Mon Oct 29 19:03:51 2007 From: gail.nagle at baesystems.com (Nagle, Gail A (US SSA)) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Searching xsd-users archives Message-ID: Hello, Is there a way to search the xsd-user archives? Sorry if I have missed an obvious answer. Thanks, -Gail Nagle BAE Systems From boris at codesynthesis.com Tue Oct 30 07:45:59 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Searching xsd-users archives In-Reply-To: References: Message-ID: <20071030114559.GE21373@karelia> Hi Gail, Nagle, Gail A (US SSA) writes: > Is there a way to search the xsd-user archives? There is no dedicated search for mailing list archives yet. So the best option is to search the codesynthesis.com domain with Google (or other search tool) which also has an added benefit of searching docs, wiki, etc. The following Google search URL has the domain restriction embedded into it so you can just type the search terms and it will only search in codesynthesis.com: http://www.google.com/advanced_search?q=site:codesynthesis.com&hl=en Boris From gail.nagle at baesystems.com Tue Oct 30 10:38:29 2007 From: gail.nagle at baesystems.com (Nagle, Gail A (US SSA)) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Searching xsd-users archives References: <20071030114559.GE21373@karelia> Message-ID: Hi Boris, This is such a helpful suggestion that I think it would be a good idea to note it on the xsd-users page. Thank you! -Gail -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tue 10/30/2007 4:45 AM To: Nagle, Gail A (US SSA) Cc: xsd-users@codesynthesis.com Subject: Re: [xsd-users] Searching xsd-users archives Hi Gail, Nagle, Gail A (US SSA) writes: > Is there a way to search the xsd-user archives? There is no dedicated search for mailing list archives yet. So the best option is to search the codesynthesis.com domain with Google (or other search tool) which also has an added benefit of searching docs, wiki, etc. The following Google search URL has the domain restriction embedded into it so you can just type the search terms and it will only search in codesynthesis.com: http://www.google.com/advanced_search?q=site:codesynthesis.com&hl=en Boris From Michael.Forstner at cpg.de Tue Oct 30 10:51:32 2007 From: Michael.Forstner at cpg.de (Forstner Michael) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Custom namespace_infomap binding Message-ID: Hi all, following scenario: 1 XSD which imports 2 another XSDs. If I want to serialize an object to std::ostream, I have to provide a namespace_infomap with 3 entries. Another way would be if I could bind the namespace map to the specific tags but I don't know how this could be done. Today I get this output: SCRUDE51AXX MARKDEFF XX20070920000074 SCT P ICF 2007-09-20T16:20:07 1 0 CPG-2007-09-20.22 2007-09-20T16:20:07 ... But I'd like to have following syntax: SCRUDE51AXX MARKDEFF XX20070920000074 SCT P ICF 2007-09-20T16:20:07 1 0 CPG-2007-09-20.22 2007-09-20T16:20:07 ... Thanks for any help, Michael Forstner From boris at codesynthesis.com Tue Oct 30 11:05:42 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Custom namespace_infomap binding In-Reply-To: References: Message-ID: <20071030150542.GB26749@karelia> Hi Michael, Forstner Michael writes: > Today I get this output: > > xmlns:sw8="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd"> > SCRUDE51AXX > > > CPG-2007-09-20.22 > 2007-09-20T16:20:07 > ... > > But I'd like to have following syntax: > > xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd"> > SCRUDE51AXX > > > CPG-2007-09-20.22 > 2007-09-20T16:20:07 > ... There is no easy way to do exactly what you want short of serializing the outer document and the GrpHdr fragment separately into two DOM documents and then combining them into one. But, noticing that all tags in the SCLSCT vocabulary seem to be qualified, you can get the following: SCRUDE51AXX CPG-2007-09-20.22 2007-09-20T16:20:07 ... By replacing: map["sw8"]="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01"; with: map[""]="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.01"; Boris From sbalasub at qualcomm.com Tue Oct 30 13:14:32 2007 From: sbalasub at qualcomm.com (Balasubramanyam, Shivakumar) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Driver for creating a sample XML file. Message-ID: Hi, Does code synthesis create sample xml files for the code generated from XSD? I also would like to know if there is a utility tool, that will take a XSD and XML and validate the document as well? Thanks, Shiva From boris at codesynthesis.com Tue Oct 30 15:08:22 2007 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 11 15:33:59 2009 Subject: [xsd-users] Driver for creating a sample XML file. In-Reply-To: References: Message-ID: <20071030190821.GA27563@karelia> Hi Shiva, Balasubramanyam, Shivakumar writes: > Does code synthesis create sample xml files for the code generated > from XSD? No, there is no such feature. Though we are thinking about adding this functionality to the compiler. > I also would like to know if there is a utility tool, that will take > a XSD and XML and validate the document as well? Xerces-C++ includes a number of examples that can be used for that, e.g. SAXCount. These examples support a number of option that allow you to customize the validation parameters. A typical use case for validation would be: SAXCount -v=always -n -s -f text.xml Also note that the schema should be specified via schemaLocation or noNamespaceSchemaLocation in the XML document. It cannot be provided on the command line (though it won't be very difficult to create a tool that accepts the schema as a separate file). Boris