From Oliver.Jones at helvar.com Thu Aug 6 06:35:07 2015 From: Oliver.Jones at helvar.com (Jones Oliver) Date: Thu Aug 6 07:41:50 2015 Subject: [xsde-users] xml_schema namespace conflict problem Message-ID: <5DF07A4A01564042B4D8AD16AB55D03F9BB336F1@servex10.Service.asp> Hi, I'm using xsd and xsde in the same application. The xsd is required purely for non-embedded xml use whereas our use of xsde is required for cross platform windows and embedded use. The problem I have is that the namespace xml_schema is generated differently for xsd than for the xsde. Therefore I have two conflicting versions and am encountering redefinition build errors for the integral types. So basically, types like integer are being defined as long long in xsd and long in xsde. The c++ files are being generated from the xsd are using different xml schema files than for the xsde c++ file generated files. The question is how do I harmonise the xml_schema namespaces when using xsd and xsde side by side? The windows application we are using is a 32 bit application, as is our embedded application. Ideally we would like the xsd.exe to generate the xml_schema integral types as 32 bit data types and not 'long long'. I have included the two generated xml_schema namespaces below. Any help would be grately appreciated, Regards, Oliver Xml_schema namespace generated from xsde.exe namespace xml_schema { using ::xsde::cxx::hybrid::any_type; typedef ::std::string any_simple_type; typedef signed char byte; using ::xsde::cxx::hybrid::byte_base; typedef unsigned char unsigned_byte; using ::xsde::cxx::hybrid::unsigned_byte_base; typedef short short_; using ::xsde::cxx::hybrid::short_base; typedef unsigned short unsigned_short; using ::xsde::cxx::hybrid::unsigned_short_base; typedef int int_; using ::xsde::cxx::hybrid::int_base; typedef unsigned int unsigned_int; using ::xsde::cxx::hybrid::unsigned_int_base; typedef long long long_; using ::xsde::cxx::hybrid::long_base; typedef unsigned long long unsigned_long; using ::xsde::cxx::hybrid::unsigned_long_base; typedef long integer; using ::xsde::cxx::hybrid::integer_base; typedef long non_positive_integer; using ::xsde::cxx::hybrid::non_positive_integer_base; typedef unsigned long non_negative_integer; using ::xsde::cxx::hybrid::non_negative_integer_base; typedef unsigned long positive_integer; using ::xsde::cxx::hybrid::positive_integer_base; typedef long negative_integer; using ::xsde::cxx::hybrid::negative_integer_base; typedef bool boolean; using ::xsde::cxx::hybrid::boolean_base; typedef float float_; using ::xsde::cxx::hybrid::float_base; typedef double double_; using ::xsde::cxx::hybrid::double_base; typedef double decimal; using ::xsde::cxx::hybrid::decimal_base; typedef ::std::string string; typedef ::std::string normalized_string; typedef ::std::string token; typedef ::std::string name; typedef ::std::string nmtoken; typedef ::xsde::cxx::string_sequence nmtokens; typedef ::std::string ncname; typedef ::std::string language; typedef ::std::string id; typedef ::std::string idref; typedef ::xsde::cxx::string_sequence idrefs; typedef ::std::string uri; using ::xsde::cxx::qname; using ::xsde::cxx::buffer; typedef ::xsde::cxx::buffer base64_binary; typedef ::xsde::cxx::buffer hex_binary; using ::xsde::cxx::time_zone; using ::xsde::cxx::date; using ::xsde::cxx::date_time; using ::xsde::cxx::duration; using ::xsde::cxx::gday; using ::xsde::cxx::gmonth; using ::xsde::cxx::gmonth_day; using ::xsde::cxx::gyear; using ::xsde::cxx::gyear_month; using ::xsde::cxx::time; using ::xsde::cxx::hybrid::pod_sequence; using ::xsde::cxx::hybrid::fix_sequence; using ::xsde::cxx::hybrid::var_sequence; using ::xsde::cxx::string_sequence; using ::xsde::cxx::hybrid::data_sequence; } Xml_schema namespace namespace xml_schema { // anyType and anySimpleType. // typedef ::xsd::cxx::tree::type type; typedef ::xsd::cxx::tree::simple_type< type > simple_type; typedef ::xsd::cxx::tree::type container; // 8-bit // typedef signed char byte; typedef unsigned char unsigned_byte; // 16-bit // typedef short short_; typedef unsigned short unsigned_short; // 32-bit // typedef int int_; typedef unsigned int unsigned_int; // 64-bit // typedef long long long_; typedef unsigned long long unsigned_long; // Supposed to be arbitrary-length integral types. // typedef long long integer; typedef long long non_positive_integer; typedef unsigned long long non_negative_integer; typedef unsigned long long positive_integer; typedef long long negative_integer; // Boolean. // typedef bool boolean; // Floating-point types. // typedef float float_; typedef double double_; typedef double decimal; // String types. // typedef ::xsd::cxx::tree::string< char, simple_type > string; typedef ::xsd::cxx::tree::normalized_string< char, string > normalized_string; typedef ::xsd::cxx::tree::token< char, normalized_string > token; typedef ::xsd::cxx::tree::name< char, token > name; typedef ::xsd::cxx::tree::nmtoken< char, token > nmtoken; typedef ::xsd::cxx::tree::nmtokens< char, simple_type, nmtoken > nmtokens; typedef ::xsd::cxx::tree::ncname< char, name > ncname; typedef ::xsd::cxx::tree::language< char, token > language; // ID/IDREF. // typedef ::xsd::cxx::tree::id< char, ncname > id; typedef ::xsd::cxx::tree::idref< char, ncname, type > idref; typedef ::xsd::cxx::tree::idrefs< char, simple_type, idref > idrefs; // URI. // typedef ::xsd::cxx::tree::uri< char, simple_type > uri; // Qualified name. // typedef ::xsd::cxx::tree::qname< char, simple_type, uri, ncname > qname; // Binary. // typedef ::xsd::cxx::tree::buffer< char > buffer; typedef ::xsd::cxx::tree::base64_binary< char, simple_type > base64_binary; typedef ::xsd::cxx::tree::hex_binary< char, simple_type > hex_binary; // Date/time. // typedef ::xsd::cxx::tree::time_zone time_zone; typedef ::xsd::cxx::tree::date< char, simple_type > date; typedef ::xsd::cxx::tree::date_time< char, simple_type > date_time; typedef ::xsd::cxx::tree::duration< char, simple_type > duration; typedef ::xsd::cxx::tree::gday< char, simple_type > gday; typedef ::xsd::cxx::tree::gmonth< char, simple_type > gmonth; typedef ::xsd::cxx::tree::gmonth_day< char, simple_type > gmonth_day; typedef ::xsd::cxx::tree::gyear< char, simple_type > gyear; typedef ::xsd::cxx::tree::gyear_month< char, simple_type > gyear_month; typedef ::xsd::cxx::tree::time< char, simple_type > time; // Entity. // typedef ::xsd::cxx::tree::entity< char, ncname > entity; typedef ::xsd::cxx::tree::entities< char, simple_type, entity > entities; // Namespace information and list stream. Used in // serialization functions. // typedef ::xsd::cxx::xml::dom::namespace_info< char > namespace_info; typedef ::xsd::cxx::xml::dom::namespace_infomap< char > namespace_infomap; typedef ::xsd::cxx::tree::list_stream< char > list_stream; typedef ::xsd::cxx::tree::as_double< double_ > as_double; typedef ::xsd::cxx::tree::as_decimal< decimal > as_decimal; typedef ::xsd::cxx::tree::facet facet; // Flags and properties. // typedef ::xsd::cxx::tree::flags flags; typedef ::xsd::cxx::tree::properties< char > properties; // Parsing/serialization diagnostics. // typedef ::xsd::cxx::tree::severity severity; typedef ::xsd::cxx::tree::error< char > error; typedef ::xsd::cxx::tree::diagnostics< char > diagnostics; // Exceptions. // typedef ::xsd::cxx::tree::exception< char > exception; typedef ::xsd::cxx::tree::bounds< char > bounds; typedef ::xsd::cxx::tree::duplicate_id< char > duplicate_id; typedef ::xsd::cxx::tree::parsing< char > parsing; typedef ::xsd::cxx::tree::expected_element< char > expected_element; typedef ::xsd::cxx::tree::unexpected_element< char > unexpected_element; typedef ::xsd::cxx::tree::expected_attribute< char > expected_attribute; typedef ::xsd::cxx::tree::unexpected_enumerator< char > unexpected_enumerator; typedef ::xsd::cxx::tree::expected_text_content< char > expected_text_content; typedef ::xsd::cxx::tree::no_prefix_mapping< char > no_prefix_mapping; typedef ::xsd::cxx::tree::serialization< char > serialization; // Error handler callback interface. // typedef ::xsd::cxx::xml::error_handler< char > error_handler; // DOM interaction. // namespace dom { // Automatic pointer for DOMDocument. // using ::xsd::cxx::xml::dom::auto_ptr; #ifndef XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA #define XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA // DOM user data key for back pointers to tree nodes. // const XMLCh* const tree_node_key = ::xsd::cxx::tree::user_data_keys::node; #endif } } From boris at codesynthesis.com Thu Aug 6 07:44:45 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 6 07:44:47 2015 Subject: [xsde-users] xml_schema namespace conflict problem In-Reply-To: <5DF07A4A01564042B4D8AD16AB55D03F9BB336F1@servex10.Service.asp> References: <5DF07A4A01564042B4D8AD16AB55D03F9BB336F1@servex10.Service.asp> Message-ID: Hi Oliver, Jones Oliver writes: > The question is how do I harmonise the xml_schema namespaces when using > xsd and xsde side by side? You map them to different C++ namespaces: xsd ... --namespace-map http://www.w3.org/2001/XMLSchema=xml_schema_xsd xsde ... --namespace-map http://www.w3.org/2001/XMLSchema=xml_schema_xsde Boris From Oliver.Jones at helvar.com Thu Aug 6 12:59:20 2015 From: Oliver.Jones at helvar.com (Jones Oliver) Date: Thu Aug 6 12:59:25 2015 Subject: [xsde-users] #include is located before prologue Message-ID: <5DF07A4A01564042B4D8AD16AB55D03F9BB3383D@servex10.Service.asp> Hi, I'm using the following command line with xsde xsde.exe cxx-hybrid --cxx-prologue "#include \"stdafx.h\"" --namespace-map http://www.w3.org/2001/XMLSchema=xml_schemax a.xsd However the following include line #include is still being placed above the prologue, like so: #include // Begin prologue. // #include "stdafx.h" // // End prologue. I am therefore having manually move the #include line below the prologue everytime I build my files from the schema file. // Begin prologue. // #include "stdafx.h" // // End prologue. #include Is there anything I can do to ensure that the prologue is the first section of code in my cxx file when using xsde.exe? When I build using xsd.exe, the include line #include is always located after the prologue. Which is what I desire. Kind regards, Oliver From Oliver.Jones at helvar.com Thu Aug 6 09:48:42 2015 From: Oliver.Jones at helvar.com (Jones Oliver) Date: Fri Aug 7 07:09:09 2015 Subject: [xsde-users] xml_schema namespace conflict problem In-Reply-To: References: <5DF07A4A01564042B4D8AD16AB55D03F9BB336F1@servex10.Service.asp> Message-ID: <5DF07A4A01564042B4D8AD16AB55D03F9BB337D3@servex10.Service.asp> Thanks for the quick response, Looks like I was on the right track, Regards, Oliver -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: 06 August 2015 12:45 To: Jones Oliver Cc: xsde-users@codesynthesis.com Subject: Re: [xsde-users] xml_schema namespace conflict problem Hi Oliver, Jones Oliver writes: > The question is how do I harmonise the xml_schema namespaces when > using xsd and xsde side by side? You map them to different C++ namespaces: xsd ... --namespace-map http://www.w3.org/2001/XMLSchema=xml_schema_xsd xsde ... --namespace-map http://www.w3.org/2001/XMLSchema=xml_schema_xsde Boris -------------- next part -------------- An embedded message was scrubbed... From: Jones Oliver Subject: FW: xml_schema namespace conflict problem Date: Thu, 6 Aug 2015 11:23:27 +0000 Size: 20895 Url: http://codesynthesis.com/pipermail/xsde-users/attachments/20150806/ab7f209f/attachment.mht From boris at codesynthesis.com Fri Aug 7 07:19:22 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 7 07:19:23 2015 Subject: [xsde-users] #include is located before prologue In-Reply-To: <5DF07A4A01564042B4D8AD16AB55D03F9BB3383D@servex10.Service.asp> References: <5DF07A4A01564042B4D8AD16AB55D03F9BB3383D@servex10.Service.asp> Message-ID: Hi Oliver, Jones Oliver writes: > However the following include line #include is > still being placed above the prologue, like so: > > #include This has been fixed for the next release. You can try it with the 3.3.0.a7 pre-release binary: http://codesynthesis.com/~boris/tmp/xsde/ Boris From nshaik_mj at yahoo.com Fri Aug 7 11:36:13 2015 From: nshaik_mj at yahoo.com (Nazeer Shaik) Date: Fri Aug 7 11:36:20 2015 Subject: [xsde-users] #include is located before prologue In-Reply-To: References: Message-ID: <395590244.745001.1438961773423.JavaMail.yahoo@mail.yahoo.com> Can someone tell how to unsubscribe from this mailing list ?? On Friday, August 7, 2015 7:20 AM, Boris Kolpackov wrote: Hi Oliver, Jones Oliver writes: > However the following include line #include is > still being placed above the prologue, like so: > > #include This has been fixed for the next release. You can try it with the 3.3.0.a7 pre-release binary: http://codesynthesis.com/~boris/tmp/xsde/ Boris From Jonathan.Haws at sdl.usu.edu Fri Aug 28 01:19:05 2015 From: Jonathan.Haws at sdl.usu.edu (Jonathan Haws) Date: Fri Aug 28 01:19:53 2015 Subject: [xsde-users] Stream of Documents to Parse Message-ID: All, I've got a quick question. I'm in a situation where I have a stream of documents to parse. I know I can setup the parser to handle a streamed document, but what about multiple documents back to back? For example, let's say I have a simple schema that defines a document like this: value Parsing that as a stream is simple - there are examples that do that. However, now let's say that I have a stream coming from a socket where the documents can come in back to back: value value value Is there a way to handle this that is built into the library? What I mean is, can I simply instantiate a document parser and continuously feed it data from the stream and have it return some code when the closing tag of the root element is seen? Or even just allocate space for all root elements and children seen similar to how sequences are handled? Then I can just get the number of full documents received and pull the data for each one? I can work out a way to handle this outside and just stream the partials to the parser outside - keeping track of the start and end of a document myself, but if there was a way to handle this that was built into the tools and library that would be absolutely fantastic! Thanks! Jon From boris at codesynthesis.com Fri Aug 28 10:48:35 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 28 10:48:43 2015 Subject: [xsde-users] Stream of Documents to Parse In-Reply-To: References: Message-ID: Hi Jonathan, Jonathan Haws writes: > Is there a way to handle this that is built into the library? No, according to the XML specification, any non-whitespace "junk" after the closing tag of the root element makes the document invalid. So you will have to split your streams into valid XML documents before you feed them to XSD/e. Boris