From gordan.sikic at uljanik.hr Fri Jun 1 05:44:18 2012 From: gordan.sikic at uljanik.hr (Gordan Sikic) Date: Fri Jun 1 05:44:29 2012 Subject: [xsd-users] DLL's VS 2010 and dllexport problems revisited In-Reply-To: References: <4FC37B2E.1050200@uljanik.hr> <4FC47F4A.2040800@uljanik.hr> Message-ID: <4FC88EF2.9080606@uljanik.hr> Hi Boris, sorry for not answering so long... >> [...] >> >> I tried it (and followed it correctly), more than once. > > In this case you will need to create another (root) DLL which will > contain just xml-schema.hxx (generated with the --export-xml-schema) > option (step 1). You will also need to create a dummy xml-schema.cxx > file (step 2). All your other schemas must be compiled with the > --extern-xml-schema option to use this xml-schema.hxx from the root > DLL and also link to this root DLL (step 3). > > Have you done all of this? > I have done it, and during last two days I've checked and rechecked everything once more. As I stated before, none of suggestions really solved the problem. sorry. I'll try to write python script to transform generated headers into form where functions are exported. I'll let you know about results. I would like to thank you once more for your time, best regards, Gordan The information in this email is confidential and it is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any distribution, copying, duplication or disclosure is prohibited and may be unlawful. If you have received this email in error, please notify the sender immediately and destroy it, and all copies of it. Ova poruka je povjerljiva i namijenjena isklju?ivo primateljima navedenim u zaglavlju iste. Svaki pristup, distribucija, umno?avanje ili otkrivanje sadr?aja ove poruke tre?im osobama strogo je zabranjeno i smatra se protuzakonitim. Ukoliko ste gre?kom dobili ovu poruku, molimo Vas da ?to prije obavijestite po?iljatelja poruke i uni?tite sve postoje?e kopije. From boris at codesynthesis.com Fri Jun 1 10:04:51 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 10:04:59 2012 Subject: [xsd-users] DLL's VS 2010 and dllexport problems revisited In-Reply-To: <4FC88EF2.9080606@uljanik.hr> References: <4FC37B2E.1050200@uljanik.hr> <4FC47F4A.2040800@uljanik.hr> <4FC88EF2.9080606@uljanik.hr> Message-ID: Hi Gordan, Gordan Sikic writes: > I have done it, and during last two days I've checked and rechecked > everything once more. As I stated before, none of suggestions really > solved the problem. sorry. That's very strange. Have you tried to isolate the problem by removing one schema at a time to see what exactly is causing the problem? In my experience, the cause is normally a schema file that was not compiled with the --extern-xml-schema option. Boris From boris at codesynthesis.com Fri Jun 1 11:14:36 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 11:14:43 2012 Subject: [xsd-users] how do i use xse:refType with extra attribute? In-Reply-To: <4FC7C08D.401@tower-research.com> References: <4FC7AA7A.1020802@tower-research.com> <4FC7C08D.401@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > It looks like this should work but it doesn't. xsd quits with the > following :- > xsd: /apps/stonefs1/owagh/softwares/xsd-3.3.0+dep/libxsd-frontend/xsd-frontend/semantic-graph/elements.hxx:411: > XSDFrontend::SemanticGraph::Scope& > XSDFrontend::SemanticGraph::Nameable::scope(): Assertion `named_p ()' failed. This appears to be a regression in XSD. I have fixed it for the next release. Thanks for the report! I am travelling at the moment and unfortunately won't be able to build you a pre-release binary with the fix until the 15th (building a portable binary requires a special setup which I cannot access right now). However, I can provide you with the patch which you can apply to the xsd-3.3.0+dep source code and build the binary yourself. I assume you are on Linux. If that's the case, then the process will be fairly straightforward. Let me know if you would like to go this route. Boris From owagh at tower-research.com Fri Jun 1 11:30:01 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Fri Jun 1 11:30:08 2012 Subject: [xsd-users] how do i use xse:refType with extra attribute? In-Reply-To: References: <4FC7AA7A.1020802@tower-research.com> <4FC7C08D.401@tower-research.com> Message-ID: <4FC8DFF9.4090704@tower-research.com> Hi On 06/01/2012 11:14 AM, Boris Kolpackov wrote: > However, I can provide you with the patch which you can apply to the > xsd-3.3.0+dep source code and build the binary yourself. I assume you > are on Linux. If that's the case, then the process will be fairly > straightforward. Let me know if you would like to go this route. Thanks, the patch would be good. I'm compiling the binary from source anyways. Omkar From owagh at tower-research.com Fri Jun 1 11:33:22 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Fri Jun 1 11:33:25 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> Message-ID: <4FC8E0C2.8030200@tower-research.com> Hi Boris On 05/31/2012 12:16 PM, Boris Kolpackov wrote: > sbu_new._container (&doc); > > Boris Can you point me to some documentation for this function? I couldn't find anything about this in the manual. Omkar From boris at codesynthesis.com Fri Jun 1 12:08:19 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 12:08:26 2012 Subject: [xsd-users] how do i use xse:refType with extra attribute? In-Reply-To: <4FC8DFF9.4090704@tower-research.com> References: <4FC7AA7A.1020802@tower-research.com> <4FC7C08D.401@tower-research.com> <4FC8DFF9.4090704@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Thanks, the patch would be good. I'm compiling the binary from source > anyways. Here you go: http://www.codesynthesis.com/~boris/tmp/xsd/xsd-3.3.0-1+dep-idref.patch Boris From boris at codesynthesis.com Fri Jun 1 12:13:41 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 12:13:49 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: <4FC8E0C2.8030200@tower-research.com> References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Can you point me to some documentation for this function? I couldn't > find anything about this in the manual. It is an internal function that is not really supposed to be used by the end-user (it is called automatically when you add a node to a tree). Thus it is not documented. The only really important thing that you need to make sure when using it directly is that the node shall not outlive the tree (the container). Boris From owagh at tower-research.com Fri Jun 1 14:42:55 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Fri Jun 1 14:42:58 2012 Subject: [xsd-users] Compiling with boost 1.46 Message-ID: <4FC90D2F.7070602@tower-research.com> Did anyone get xsd to compile with boost 1.46? I could only get it to compile with 1.44... What version of boost is xsd guaranteed to compile with? Omkar From boris at codesynthesis.com Fri Jun 1 15:07:53 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 15:07:59 2012 Subject: [xsd-users] Compiling with boost 1.46 In-Reply-To: <4FC90D2F.7070602@tower-research.com> References: <4FC90D2F.7070602@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Did anyone get xsd to compile with boost 1.46? At some point Boost removed functions from the filesystem::path class that were used by XSD. We are planning to "fix" this in the next release by getting rid of the Boost dependency altogether. > I could only get it to compile with 1.44... > What version of boost is xsd guaranteed to compile with? We didn't try to figure out which version of Boost broke the compatibility. The official binaries were build with 1.33.1, which is a fairly old version. But if it compiles with 1.44, then you should be fine using that version. Boris From owagh at tower-research.com Fri Jun 1 17:02:36 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Fri Jun 1 17:02:39 2012 Subject: [xsd-users] Compiling with boost 1.46 In-Reply-To: References: <4FC90D2F.7070602@tower-research.com> Message-ID: <4FC92DEC.6090907@tower-research.com> Hi On 06/01/2012 03:07 PM, Boris Kolpackov wrote: > Hi Omkar, > > Omkar Wagh writes: > >> Did anyone get xsd to compile with boost 1.46? > At some point Boost removed functions from the filesystem::path > class that were used by XSD. We are planning to "fix" this in the > next release by getting rid of the Boost dependency altogether. Yeah it's always a good idea not to build a library on top of another library that is always in such a state of flux. Is there a release schedule put up somewhere? > >> I could only get it to compile with 1.44... >> What version of boost is xsd guaranteed to compile with? > We didn't try to figure out which version of Boost broke the > compatibility. The official binaries were build with 1.33.1, > which is a fairly old version. But if it compiles with 1.44, > then you should be fine using that version. And no it doesn't compile with that either. The same kind of filesystem::path undefined references. *sigh* I'll have to get 1.33.1 from somewhere I suppose (at least until the official binaries are released). > > Boris Thanks a lot for your time Boris. Omkar From boris at codesynthesis.com Mon Jun 4 03:50:10 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 4 03:50:18 2012 Subject: [xsd-users] Compiling with boost 1.46 In-Reply-To: <4FC92DEC.6090907@tower-research.com> References: <4FC90D2F.7070602@tower-research.com> <4FC92DEC.6090907@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Is there a release schedule put up somewhere? It is still several months out. We are waiting for VC11, besides other things. > And no it doesn't compile with that either. I've patched 3.3.0 to compile with newer versions of Boost as well as with more strict GCC 4.7 and Clang (you will still need to apply the idref patch, though). The package is called xsd-3.3.0-2+dep and you can get it here: http://www.codesynthesis.com/download/xsd/3.3/ Boris From rlischner at proteuseng.com Mon Jun 4 10:50:23 2012 From: rlischner at proteuseng.com (Ray Lischner) Date: Mon Jun 4 10:55:55 2012 Subject: [xsd-users] Plans f or C++11? Message-ID: What are your plans for C++11? Currently, Code Synthesis 3.3 has a number of features that can be used to reduce the amount of copying, such as using auto_ptr<> for required, non-fundamental data members, which would probably be better off taking advantage of move semantics. That is, if an element has cardinality one, don't use a pointer to store it, and don't take an auto_ptr<> argument in the constructor. Instead, take an object by value, and move it into the data member. The root-element construction functions should return objects by value, so they can be moved to their destination. Etc., etc., etc. I realize this is a significant change to the way Code Synthesis works now, and you would need to support C++03 and C++11 in the same product, but I think the performance gains could be significant. Ray Lischner, Distinguished Member of Technical Staff 133 National Business Pkwy, Ste 150 t. 443.539.3448 Annapolis Junction, MD 20701 c. 410.854.9787 rlischner@proteuseng.com f. 443.539.3370 From mjklaim at gmail.com Mon Jun 4 22:22:14 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Mon Jun 4 22:22:22 2012 Subject: [xsd-users] Plans f or C++11? In-Reply-To: References: Message-ID: On Mon, Jun 4, 2012 at 11:50 PM, Ray Lischner wrote: > That is, if an element has cardinality one, don't use a pointer to store > it, and don't take an auto_ptr<> argument in the constructor. Instead, take > an object by value, and move it into the data member. The root-element > construction functions should return objects by value, so they can be moved > to their destination. Etc., etc., etc. > I think a more obvious enhancement would be to replace the auto_ptr with unique_ptr. I believe It have different costs than when modifying model data than relying on move semantic that would help only for elements containing other elements, and not for most the values they hold. Now, I agree that having the option to generate the code in a movable/copyable only fashion (instead of pointers) would be interesting too anyway. Joel Lamotte From diman4ik.chernov at gmail.com Tue Jun 5 03:18:29 2012 From: diman4ik.chernov at gmail.com (Dmitry Chernov) Date: Tue Jun 5 03:18:37 2012 Subject: [xsd-users] Xsd file encoding. Message-ID: After setting up xsd compilation in Visual Studio as described in wiki ( here: http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio ), I get hxx and cxx files like this (hxx file for example): // Forward declarations. // class cxx_________________; class cxx________________; class cxx________; class cxx___________; class cxx____________; class cxx__________; class cxx________1; class cxx__________1; class cxx_______; I guess I have a problem with xsd file encoding. My xsd is encoded with winows 1251 encoding. Is it possible to work with this encoding and how do I setup it up? Thank you, Dmitry. From boris at codesynthesis.com Tue Jun 5 04:02:04 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 5 04:02:12 2012 Subject: [xsd-users] Xsd file encoding. In-Reply-To: References: Message-ID: Hi Dmitry, Dmitry Chernov writes: > class cxx_________________; > > I guess I have a problem with xsd file encoding. My xsd is encoded > with winows 1251 encoding. Is it possible to work with this encoding > and how do I setup it up? The problem is not really the schema encoding. I suspect you are using Russian letters in your element/type names. Since you cannot use such letters in C++ identifiers, XSD replaces them with '_'. You can try to use the --reserved-name option to re-map such identifiers to something in the Latin alphabet, however, I am not sure it will work. What will definitely work is to change the element/type names in your schema to use Latin instead of Russian characters. Boris From boris at codesynthesis.com Tue Jun 5 04:13:16 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 5 04:13:23 2012 Subject: [xsd-users] Plans f or C++11? In-Reply-To: References: Message-ID: Hi Ray, Ray Lischner writes: > What are your plans for C++11? We are thinking about it ;-). > Currently, Code Synthesis 3.3 has a number of features that can be > used to reduce the amount of copying, such as using auto_ptr<> for > required, non-fundamental data members, which would probably be > better off taking advantage of move semantics. > > That is, if an element has cardinality one, don't use a pointer to > store it, and don't take an auto_ptr<> argument in the constructor. > Instead, take an object by value, and move it into the data member. This is a good idea except for polymorphic objects. So we will have to have separate mapping for polymorphic/non-polymorphic types. This is the extra complexity that we could really do without. > The root-element construction functions should return objects by > value, so they can be moved to their destination. The same story. We cannot do this for polymorphic objects. > I realize this is a significant change to the way Code Synthesis > works now, and you would need to support C++03 and C++11 in the > same product, but I think the performance gains could be significant. Yes, though we will need to think more about the implications, especially wrt extra complexity and whether it is worth it. But I agree, for starters, we should at least support the move semantics for generated types plus use std::unique_ptr instead of auto_ptr. If you (or anyone else) have other suggestions/ideas wrt to C++11 support, do let me know. Boris From owagh at tower-research.com Tue Jun 5 15:10:09 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Tue Jun 5 15:10:13 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> Message-ID: <4FCE5991.3010007@tower-research.com> Hi Boris On 06/01/2012 12:13 PM, Boris Kolpackov wrote: > Hi Omkar, > > It is an internal function that is not really supposed to be used by the > end-user (it is called automatically when you add a node to a tree). Thus > it is not documented. Is there any chance of this becoming an officially supported/documented function sometime in the near future? I don't want to use it unless I know it is stable and supported. > The only really important thing that you need to make sure when using > it directly is that the node shall not outlive the tree (the container). This sounds perfect for my use. Omkar From diman4ik.chernov at gmail.com Wed Jun 6 01:40:32 2012 From: diman4ik.chernov at gmail.com (Dmitry Chernov) Date: Wed Jun 6 01:40:39 2012 Subject: [xsd-users] xsd internationalization. Message-ID: In our software we need to generate xml with cyrillic letters from cyrillic xsd. Maybe it would be reasonable to have two types of xsd: one plain latin and one cyrillic. People who are responsible for creation of xsd would make cyrillic, we would transliterate it with script. Than with xsd generate C++ classes from latin xsd. Than at runtime our software would serialize C++ objects in cyrillic xml. Is it possible to add such an oportunity to xsd lib? Thank you. From boris at codesynthesis.com Wed Jun 6 03:20:11 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 03:20:18 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: <4FCE5991.3010007@tower-research.com> References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Is there any chance of this becoming an officially supported/documented > function sometime in the near future? I don't want to use it unless I > know it is stable and supported. I don't see this function going away. However, seeing that it is not expected to be used directly (you are the first person finding it useful), I think our time is better spend elsewhere rather than documenting its requirements, etc. Boris From boris at codesynthesis.com Wed Jun 6 03:42:08 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 03:42:14 2012 Subject: [xsd-users] xsd internationalization. In-Reply-To: References: Message-ID: Hi Dmitry, Dmitry Chernov writes: > In our software we need to generate xml with cyrillic letters from > cyrillic xsd. Maybe it would be reasonable to have two types of xsd: > one plain latin and one cyrillic. People who are responsible for > creation of xsd would make cyrillic, we would transliterate it with > script. Than with xsd generate C++ classes from latin xsd. Than at > runtime our software would serialize C++ objects in cyrillic xml. Is > it possible to add such an oportunity to xsd lib? Let me first clarify that we are talking about supporting Cyrillic element/attribute/type names and not Cyrillic XML content (i.e., the values of elements/attributes). The latter works fine right now. The problem with Cyrillic element/attribute/type names is that C++ only supports Latin names in the identifiers and so the XSD compiler replaces all non-Latin characters with '_'. The result are C++ names like 'cxx___', which are not very usable. See also this earlier thread for more context: http://www.codesynthesis.com/pipermail/xsd-users/2012-June/003653.html Now, the type names in XSD normally don't get exposed in XML (xsi:type is the exception) so those could be changed to Latin without any changes to XML. Element/attribute names, however, do end up in the resulting XML. Your suggestion won't work because if you use the Latin version of your schema to generate the C++ model, then the generated code will expect Latin element/attribute names in XML. One way to work around this would be to pre-process the DOM document before passing it on to the XSD-generated code by changing all the Cyrillic element/attribute names to the Latin ones (the same can also be done for serialization, except in the other direction). This can actually be implemented right now with a bit of effort. The way to support this directly in XSD would be in way similar to the --reserved-name option, which allows you to map any name that is used as a C++ identifier to some alternative name: --reserved-name = The reason why this approach doesn't work right now is because we don't support anything except Latin characters in this option. Fixing this in a portable way won't be trivial either. So we would rather not go this way. Another alternative would be to do something similar to what we have done to support custom C++ literals (see the --custom-literals option). Essentially, we would add another options, say --custom-identifiers, with which you will be able to pass an XML file that contains mappings between Cyrillic names and the Latin names that should be used instead in the C++ code. Boris From PaquetP at navcanada.ca Wed Jun 6 08:18:30 2012 From: PaquetP at navcanada.ca (Paquette, Patrick) Date: Wed Jun 6 08:21:33 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com>, Message-ID: Hi Boris, Boris Kolpackov ?[boris@codesynthesis.com]? writes: > I don't see this function going away. However, seeing that it is not > expected to be used directly (you are the first person finding it useful), > I think our time is better spend elsewhere rather than documenting its > requirements, etc. For what it's worth, I've used it to navigate back to the parent object when all I have is a pointer to an element in a sequence. I'm first ;) Patrick From boris at codesynthesis.com Wed Jun 6 10:11:04 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 10:11:10 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> Message-ID: Hi Patrick, Paquette, Patrick writes: > For what it's worth, I've used it to navigate back to the parent object > when all I have is a pointer to an element in a sequence. I'm first ;) Well, Omkar is using the setter version. One can think of good reasons why the client code could want to use the getter. Accidentally, it is also undocumented. Ok, I've added an item to our TODO list to document both. Not sure if/when we will get to that, though. Boris From boris at codesynthesis.com Wed Jun 6 10:16:14 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 10:16:20 2012 Subject: [xsd-users] xsd internationalization. In-Reply-To: References: Message-ID: Hi Dmitry, In the future please keep your replies CC'ed to the xsd-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Dmitry Chernov writes: > > Essentially, we would add another option, say --custom-identifiers, > > with which you will be able to pass an XML file that contains mappings > > between Cyrillic names and the Latin names that should be used instead > > in the C++ code > > That would be good option I think. I am still not convinced it is worth spending time on that, though. Schemas with non-Latin element/attribute names are quite rare. In fact, you are the first person trying to use one with XSD. What about the DOM pre/post-processing approach? I realize it is more work for you (instead of for us ;-)) but maybe it is the right way to handle this "unusual" case? Boris From diman4ik.chernov at gmail.com Thu Jun 7 00:16:03 2012 From: diman4ik.chernov at gmail.com (Dmitry Chernov) Date: Thu Jun 7 00:16:10 2012 Subject: [xsd-users] xsd internationalization. In-Reply-To: References: Message-ID: On Wed, Jun 6, 2012 at 6:16 PM, Boris Kolpackov wrote: > Hi Dmitry, > > In the future please keep your replies CC'ed to the xsd-users mailing > list as discussed in the posting guidelines: > > http://www.codesynthesis.com/support/posting-guidelines.xhtml > > > Dmitry Chernov writes: > >> > Essentially, we would add another option, say --custom-identifiers, >> > with which you will be able to pass an XML file that contains mappings >> > between Cyrillic names and the Latin names that should be used instead >> > in the C++ code >> >> That would be good option I think. > > I am still not convinced it is worth spending time on that, though. > Schemas with non-Latin element/attribute names are quite rare. In > fact, you are the first person trying to use one with XSD. > > What about the DOM pre/post-processing approach? I realize it is > more work for you (instead of for us ;-)) but maybe it is the right > way to handle this "unusual" case? > > Boris Maybe. The difference in our case is that preprocessing can be done once during development because we know all the xsd the program will be working with. But postprocessing should be done everytime the program produces xml on the end user machine. So preferably it should be a part of the C++ program, while preprocessing we can do with a script once during development. Anyhow, thank you, Boris. Dmitry. From kmilhous at yahoo.com Sun Jun 10 12:27:36 2012 From: kmilhous at yahoo.com (Keith Milhouse) Date: Sun Jun 10 15:33:41 2012 Subject: [xsd-users] retrieving data from wildcard element Message-ID: <1339345656.67334.YahooMailNeo@web160304.mail.bf1.yahoo.com> I have a schema where I am not able to retrieve the wildcard element's value from the parsed xml.? The element in question is 'Value' in the below schema.? When examining the "Value:any_optional", the .present() check always fails.? Disabling the check and attempting to create a DOMElement using the any_optional get method generates a seg fault with this msg - "RuntimeError: Error reading string from inferior: Input/output error".? Retrieving dom_document() from the Value object provides the same kind of seg fault when examining its contents.? The schema is a scaled down version of one that I'm required to use, so I can't change its design.??? I'm running on CentOS 5.8, using xsd-3.3.0.1 and xerces 2.7.? I'm generating source from schema with the following command. xsdcxx cxx-tree? --generate-ostream --generate-wildcard --generate-inline? CommandMessage.xsd Code Snippet: std::auto_ptr cmd( ??? ??? ??? ??? CommandMessage_( ??? ??? ??? ??? ??? ??? dom1, ??? ??? ??? ??? ??? ??? xml_schema::flags::keep_dom ??? ??? ??? ??? ??? ??? ??? ??? | xml_schema::flags::dont_initialize, props)); // works with props ??? ??? CommandMessage::Command_optional cmds = cmd->Command(); ??? ??? if (cmds != NULL) ??? ??? { ??? ??? ??? CommandType ct = cmds.get(); ??? ??? ??? CommandType::ExtendedCommand_type extCmd = ct.ExtendedCommand(); ??? ? ??? ??? ??? ExtendedCommandType::Parameter_sequence &ps = extCmd.Parameter(); ??? ??? ??? for (ExtendedCommandType::Parameter_const_iterator b(ps.begin()), ??? ??? ??? ??? ??? e(ps.end()); b != e; ++b) ??? ??? ??? { ??? ??? ??? ??? cout << "Parameter DataType:" << b->DataType() << endl; ??? ??? ??? ??? AnnotatedDataType::Value_optional val = b->Value(); ??? ??? ??? ??? cout << "Parameter Value?? :" << b->Value().get() << endl; ??? ??? ??? ??? Value value = b->Value().get(); ??? ??? ??? ??? Value::any_optional &valO = value.any(); ??? ??? ??? ??? if (valO.present()) ??? ??? ??? ??? { ??? ??? ??? ??? ??? DOMElement &elem(valO.get()); ??? ??? ??? ??? ??? cout << "Elem local name = " << xsd::cxx::xml::transcode< ??? ??? ??? ??? ??? ??? ??? char>(elem.getLocalName()) << endl; ??? ??? ??? ??? } } Schema: ? ??? ????? ????????? ??????????? The issued command. ????????? ?????? ??? ? ? ??? ????? The type of command. ??? ??? ????? ??? ? ? ??? ????? Extended command, allowing extensible command structures. ??? ??? ????? ??? ??? ??? ? ? ??? ????? ??????? ????????? ??????????? Based upon the value of the DataType attribute, value can contain contain an instance of a standard XSD data type. ????????? ??????? ??????? ????????? ??????????? ????????? ??????? ????? ??? ???? ? Sample XML: ? ??? ????? ??????? true ????? ??? ? Not sure what I'm missing. thanks, Keith Milhouse From boris at codesynthesis.com Mon Jun 11 05:35:15 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 11 05:37:51 2012 Subject: [xsd-users] retrieving data from wildcard element In-Reply-To: <1339345656.67334.YahooMailNeo@web160304.mail.bf1.yahoo.com> References: <1339345656.67334.YahooMailNeo@web160304.mail.bf1.yahoo.com> Message-ID: Hi Keith, Keith Milhouse writes: > I have a schema where I am not able to retrieve the wildcard element's > value from the parsed xml. > > [...] > > > > > > > > > > Sample XML: > > [...] > > true This is not really wildcard content. xs:any in the above type will match any nested element. But what you have is text, which is allowed thanks to the type having mixed content (mixed="true"). In other words, if you had something like this: true Then there would be an element (true) in the wildcard content. The way it is now, you will need to retrieve it as mixed content. See the 'mixed' and 'custom/mixed' examples for details on how this can be done. Boris From kmilhous at yahoo.com Mon Jun 11 06:41:45 2012 From: kmilhous at yahoo.com (Keith Milhouse) Date: Mon Jun 11 09:00:09 2012 Subject: [xsd-users] retrieving data from wildcard element In-Reply-To: References: <1339345656.67334.YahooMailNeo@web160304.mail.bf1.yahoo.com> Message-ID: <1339411305.7095.YahooMailNeo@web160305.mail.bf1.yahoo.com> Thanks Boris.? I had been through those examples before but instead of just extracting the data in Value from the node n using the DOM Interface, I was attempting to cast to type Value and use it.? I'm curious why casting to Value and using its container still does not allow me to retrieve the data stored in Value. // From using the mixed example. // Found Element Node Value xml_schema::type & t(*reinterpret_cast (n->getUserData(xml_schema::dom::tree_node_key))); Value& a(dynamic_cast (t)); Value::any_optional &valO = a.any(); if (valO.present()) { ??? DOMElement &elem(valO.get()); ??? cout << "Elem local name = " << xsd::cxx::xml::transcode(elem.getLocalName()) << endl; ?} valO is not present.? Any ideas what I'm doing wrong? thanks, Keith Milhouse ________________________________ From: Boris Kolpackov To: Keith Milhouse Cc: "xsd-users@codesynthesis.com" Sent: Monday, June 11, 2012 5:35 AM Subject: Re: [xsd-users] retrieving data from wildcard element Hi Keith, Keith Milhouse writes: > I have a schema where I am not able to retrieve the wildcard element's > value from the parsed xml. > > [...] > >? ? ? >? ? ? ? >? ? ? ? ? >? ? ? ? ? ? >? ? ? ? ? >? ? ? ? >? ? ? > > Sample XML: > > [...] > >? ? ? ? true This is not really wildcard content. xs:any in the above type will match any nested element. But what you have is text, which is allowed thanks to the type having mixed content (mixed="true"). In other words, if you had something like this: true Then there would be an element (true) in the wildcard content. The way it is now, you will need to retrieve it as mixed content. See the 'mixed' and 'custom/mixed' examples for details on how this can be done. Boris From boris at codesynthesis.com Mon Jun 11 09:13:28 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 11 09:14:02 2012 Subject: [xsd-users] retrieving data from wildcard element In-Reply-To: <1339411305.7095.YahooMailNeo@web160305.mail.bf1.yahoo.com> References: <1339345656.67334.YahooMailNeo@web160304.mail.bf1.yahoo.com> <1339411305.7095.YahooMailNeo@web160305.mail.bf1.yahoo.com> Message-ID: Hi Keith, Keith Milhouse writes: > // From using the mixed example. > // Found Element Node Value > xml_schema::type & t(*reinterpret_cast (n->getUserData(xml_schema::dom::tree_node_key))); > Value& a(dynamic_cast (t)); > > Value::any_optional &valO = a.any(); > > if (valO.present()) > { > DOMElement &elem(valO.get()); > cout << "Elem local name = " << xsd::cxx::xml::transcode(elem.getLocalName()) << endl; > } > > valO is not present. Any ideas what I'm doing wrong? You are still confused about what's going on here. There is nothing between and tags in your XML that matches the wildcard. So it doesn't matter whether you access the widlcard content in the Value node directly or go via DOM (this, BTW, will result in the same node, as per design) -- your wildcard content will still be empty. xs:any matches elements. Your content is text. Boris From bschindler at inf.ethz.ch Mon Jun 11 13:34:56 2012 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Mon Jun 11 13:35:09 2012 Subject: [xsd-users] any-type Problems Message-ID: <4FD62C40.9010002@inf.ethz.ch> Hi I have this schema here: I use processContents="skip" just to disable validation. What I need to do (its part of a migration plan) is to serialize my polymorphic BaseSettings objects back to xml which are then parsed by another framework. What I noticed is that my GenericSettings class generated by xsd does not contain any members and serializing back to xml will not give me any element. Is this intentional? Thank you Benjamin Schindler From boris at codesynthesis.com Tue Jun 12 01:25:41 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 12 01:25:44 2012 Subject: [xsd-users] any-type Problems In-Reply-To: <4FD62C40.9010002@inf.ethz.ch> References: <4FD62C40.9010002@inf.ethz.ch> Message-ID: Hi Benjamin, Benjamin Schindler writes: > I have this schema here: > > [...] > > > > What I noticed is that my GenericSettings class generated by xsd does > not contain any members and serializing back to xml will not give me any > element. Is this intentional? I think you didn't compile your schema with the --generate-wildcard option, which adds support for XML Schema wildcards (xs:any and xs:anyAttribute). Note that there are some other actions that you will need to take (that's the reason why this support is not enabled by default), as described in Section 2.12, "Mapping for any and anyAttribute" in the C++/Tree Mapping User Manual: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.12 Boris From bschindler at inf.ethz.ch Tue Jun 12 03:15:08 2012 From: bschindler at inf.ethz.ch (Benjamin Schindler) Date: Tue Jun 12 03:15:21 2012 Subject: [xsd-users] any-type Problems In-Reply-To: References: <4FD62C40.9010002@inf.ethz.ch> Message-ID: <4FD6EC7C.5010502@inf.ethz.ch> Hi Boris You are right, this was it. Thanks a lot Benjamin On 12.06.2012 07:25, Boris Kolpackov wrote: > Hi Benjamin, > > Benjamin Schindler writes: > >> I have this schema here: >> >> [...] >> >> >> >> What I noticed is that my GenericSettings class generated by xsd does >> not contain any members and serializing back to xml will not give me any >> element. Is this intentional? > I think you didn't compile your schema with the --generate-wildcard option, > which adds support for XML Schema wildcards (xs:any and xs:anyAttribute). > Note that there are some other actions that you will need to take (that's > the reason why this support is not enabled by default), as described in > Section 2.12, "Mapping for any and anyAttribute" in the C++/Tree Mapping > User Manual: > > http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.12 > > Boris From daniel.berglund at scilifelab.se Mon Jun 18 08:59:05 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Mon Jun 18 08:59:16 2012 Subject: [xsd-users] Namespaces Message-ID: Hi I am having some problems making an xsd file. I am starting to suspect there is something wrong with the xml file but I am not sure. The xml file looks something like this //This row is here when it works . . . . . GAML namespace here When the parser is validating it cant find any of the elements or attributes. If I add a namespace xmlns="test_space" to the xml and targetnamespace="test_space" it works. So many question is if there is a declaration for namespace missing in the xml file or am I simply missing to write something in the xsd file? The fact that there is another namespace(GAML) in the file makes it more complicated to I think. The xsd file looks like this: //This row is here when it works Related to GAML namespace I had trouble importing it, the error I get is that it says that the namespace is "" and its expecting " http://www.bioml.com/gaml/" but targetnamespace is declared in the GAML xsd file. Any idea what the problem is? The header in gaml.xsd Regards Daniel From boris at codesynthesis.com Mon Jun 18 09:51:01 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 09:46:41 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: Hi Daniel, Daniel Berglund writes: > If I add a namespace xmlns="test_space" to the xml and > targetnamespace="test_space" it works. So many question is if there > is a declaration for namespace missing in the xml file or am I simply > missing to write something in the xsd file? Its hard to tell from the cut-out parts that you have shown, but it seem that you found a combination that works. Generally, if your XML uses a namespace, then there should be a corresponding targetNamespace in the schema, and vice-versa. Boris From daniel.berglund at scilifelab.se Mon Jun 18 09:52:44 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Mon Jun 18 09:52:52 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: The probelem is that I had to add a namespace (test_space) to the xml for it to work and I want to avoid modifying it. /Daniel On Mon, Jun 18, 2012 at 3:51 PM, Boris Kolpackov wrote: > Hi Daniel, > > Daniel Berglund writes: > > > If I add a namespace xmlns="test_space" to the xml and > > targetnamespace="test_space" it works. So many question is if there > > is a declaration for namespace missing in the xml file or am I simply > > missing to write something in the xsd file? > > Its hard to tell from the cut-out parts that you have shown, but > it seem that you found a combination that works. Generally, if > your XML uses a namespace, then there should be a corresponding > targetNamespace in the schema, and vice-versa. > > Boris > From boris at codesynthesis.com Mon Jun 18 10:01:37 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 09:57:16 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: Hi Daniel, Daniel Berglund writes: > The probelem is that I had to add a namespace (test_space) to the xml for > it to work and I want to avoid modifying it. Then you need to also make sure your schema doesn't define a namespace (i.e., there is no targetNamespace). If that still doesn't work for some reason, then try to create a small but complete test case (i.e., a schema and an xml file) that reproduces the problem and post it here. Boris From daniel.berglund at scilifelab.se Mon Jun 18 10:08:21 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Mon Jun 18 10:08:29 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: I used the hello world example but changed it a bit to look more like the real xml file. The error when ruining driver on the xml file is: error: no declaration found for element 'hello' Then the same error for the rest of the elements and attributes. /Daniel On Mon, Jun 18, 2012 at 4:01 PM, Boris Kolpackov wrote: > Hi Daniel, > > Daniel Berglund writes: > > > The probelem is that I had to add a namespace (test_space) to the xml for > > it to work and I want to avoid modifying it. > > Then you need to also make sure your schema doesn't define a namespace > (i.e., there is no targetNamespace). If that still doesn't work for > some reason, then try to create a small but complete test case (i.e., > a schema and an xml file) that reproduces the problem and post it > here. > > Boris > -------------- next part -------------- A non-text attachment was scrubbed... Name: driver.cxx Type: application/octet-stream Size: 892 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120618/9db513f8/driver.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: hello.xml Type: text/xml Size: 252 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120618/9db513f8/hello.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: hello.xsd Type: application/octet-stream Size: 709 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20120618/9db513f8/hello.obj From boris at codesynthesis.com Mon Jun 18 10:47:37 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 10:43:16 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: Hi Daniel, Daniel Berglund writes: > The error when ruining driver on the xml file is: error: no declaration > found for element 'hello' You see these errors because the parser cannot locate the schema. This is actually FAQ #2.1: http://wiki.codesynthesis.com/Tree/FAQ If, for example, I add the following two attributes to your XML's root element, then everything works fine: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hello.xsd" For other ways to specify this information (including without modifying your XML), see Section 5.1, "XML Schema Validation and Searching" in the C++/Tree Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 Boris From daniel.berglund at scilifelab.se Mon Jun 18 10:51:13 2012 From: daniel.berglund at scilifelab.se (Daniel Berglund) Date: Mon Jun 18 10:51:22 2012 Subject: [xsd-users] Namespaces In-Reply-To: References: Message-ID: Ok thanks for the help. On Mon, Jun 18, 2012 at 4:47 PM, Boris Kolpackov wrote: > Hi Daniel, > > Daniel Berglund writes: > > > The error when ruining driver on the xml file is: error: no declaration > > found for element 'hello' > > You see these errors because the parser cannot locate the schema. This > is actually FAQ #2.1: > > http://wiki.codesynthesis.com/Tree/FAQ > > If, for example, I add the following two attributes to your XML's root > element, then everything works fine: > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="hello.xsd" > > For other ways to specify this information (including without modifying > your XML), see Section 5.1, "XML Schema Validation and Searching" in the > C++/Tree Mapping Getting Started Guide: > > http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1 > > Boris > From mdeshmukh at onenetwork.com Tue Jun 19 05:54:21 2012 From: mdeshmukh at onenetwork.com (Mayur Deshmukh) Date: Tue Jun 19 05:59:51 2012 Subject: [xsd-users] Question on garbage collection Message-ID: <4400A6EF0C2A2A48B5B980F5C08B61B4DCB58492@DFWMAIL192.elogex.com> I have generated a classes from the xsd using c++ tree parser. Question: Does Code synthesis / code generated by code synthesis take care of garbage collection? Thanks Mayur Deshmukh One Network Ent. Pune mdeshmukh@onenetwork.com|www.onenetwork.com From mjklaim at gmail.com Tue Jun 19 08:28:56 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 19 08:29:04 2012 Subject: [xsd-users] [xsdtree] Inheritance elements order Message-ID: Hi, I have basically the same problem than there: http://stackoverflow.com/questions/10263478/is-it-possible-to-use-inheritance-in-xsd-with-variable-element-order The answer suggest that a new xsd standard, v1.1, allows inheritance with xs:all and that would solve my problem. He also says that the last xerces code does take account of theses possibilities. As xsd tree is based on xerces, I assume that it makes my problem solved implicitely...unless xsdtree is using a recent version of xerces. So my question simply is: is xsdtree up to date with xerces to allow me to use xs:all in both base and extended types? Thanks Joel Lamotte From boris at codesynthesis.com Tue Jun 19 09:14:09 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 19 09:09:38 2012 Subject: [xsd-users] Question on garbage collection In-Reply-To: <4400A6EF0C2A2A48B5B980F5C08B61B4DCB58492@DFWMAIL192.elogex.com> References: <4400A6EF0C2A2A48B5B980F5C08B61B4DCB58492@DFWMAIL192.elogex.com> Message-ID: Hi Mayur, Mayur Deshmukh writes: > Does Code synthesis / code generated by code synthesis take care > of garbage collection? I am not sure what you mean by "garbage collection". If the generated code allocates some objects dynamically, then it makes sure to free them when no longer needed. However, if you allocate some things dynamically (e.g., inside parsing callbacks), then it is your responsibility to free them. Boris From boris at codesynthesis.com Tue Jun 19 09:21:22 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 19 09:16:50 2012 Subject: [xsd-users] [xsdtree] Inheritance elements order In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > The answer suggest that a new xsd standard, v1.1, allows inheritance with > xs:all and that would solve my problem. He also says that the last xerces > code does take account of theses possibilities. He most likely meant Xerces-J. As far as I know, there hasn't been any work done in Xerces-C++ to add support for XML Schema v1.1. > So my question simply is: is xsdtree up to date with xerces to allow me to > use xs:all in both base and extended types? No, neither Xerces-C++ nor XSD support XML Schema v1.1. We also don't have any immediate plans to add this support. The problem with XML Schema v1.1 is that it continued on the same path as v1.0 instead of trying to solve the problem. v1.0 was already insanely complex. v1.1 just added to that complexity. It is also moving more and more towards "procedural validation" (e.g., xs:assert) rather than "declarative validation" which makes it a lot less suitable for data binding. As a result, we don't have any immediate plans to support new features added in v1.1. Boris From mjklaim at gmail.com Tue Jun 19 09:29:52 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 19 09:30:03 2012 Subject: [xsd-users] [xsdtree] Inheritance elements order In-Reply-To: References: Message-ID: I see. Do you have any suggestion to solve the problem of element orders? It is a great pain: my base type is called "object" and is abstract. It define that there can be a sequence of object inside the element. Now, my child types, like sprite, also define some additional elements, like the graphic properties, named "graphics". I can't find a way to allow to write this: ... <--- defined by sprite's type ... <--- child ... <----child Instead i'm forced to use xs:sequence that forces me to have to write this: ... <--- child ... <----child ... <--- defined by sprite's type This is harder to read the longer you get hierarchy. Fortunately, the format I'm writing is targeted at tools, not humans, but it's still hard to read for people debugging those files, like me. If you know a way to allow the first writing, I'm open to suggestions. Joel Lamotte From boris at codesynthesis.com Tue Jun 19 10:26:35 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 19 10:22:04 2012 Subject: [xsd-users] [xsdtree] Inheritance elements order In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > Do you have any suggestion to solve the problem of element orders? > It is a great pain: my base type is called "object" and is abstract. It > define that there can be a sequence of object inside the element. > Now, my child types, like sprite, also define some additional elements, > like the graphic properties, named "graphics". I don't think you can do anything about this in your current setup. You could get rid of the base and use element groups instead. Not very OO but will work. Another alternative would be to use substitution groups (i.e., in the base have a single abstract element which is extended as sprite, graphics, etc). One advantage of this approach is that you will be able to determine order of elements in C++/Tree. The disadvantage is that it will result in a schema that is a bit looser than what you want. Boris From mjklaim at gmail.com Tue Jun 19 10:58:13 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Tue Jun 19 10:58:22 2012 Subject: [xsd-users] [xsdtree] Inheritance elements order In-Reply-To: References: Message-ID: On Tue, Jun 19, 2012 at 11:26 PM, Boris Kolpackov wrote: > I don't think you can do anything about this in your current setup. > You could get rid of the base and use element groups instead. Not very > OO but will work. Another alternative would be to use substitution > groups (i.e., in the base have a single abstract element which is > extended as sprite, graphics, etc). One advantage of this approach > is that you will be able to determine order of elements in C++/Tree. > The disadvantage is that it will result in a schema that is a bit > looser than what you want. > Actually I'm already using all you cite. It is ok on C++ side but not on XML side. Anyway I guess it can't be solved right now and it's not a major problem. Thanks. Joel Lamotte From mjklaim at gmail.com Wed Jun 20 05:47:25 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Wed Jun 20 05:47:34 2012 Subject: [xsd-users] Attribute list as a C++ list of token Message-ID: Hi, So I'm working on my format ( http://code.google.com/p/art-of-sequence/source/browse/aosl/aosl.xsd) and recently I added several types defined llike this (line 1764 and following): -----------CODE---------------------- Type for reference to an unique Id. Reference to a Stage. List of references to a Stages. Reference to one or more stages automatically found by using a search logic. Represent all the stages. Useful to allow a move to be available from all the stages. Reference to one or several stages or to a special reference to stages. -----------CODE---------------------- It works well and xsd-tree generate code without a problem. Notice the list, and it's usage in stage_ref_ex. (here is my configuration file for xsd-tree: http://code.google.com/p/art-of-sequence/source/browse/tools/aoslcpp/script/generate_cpp.cfg) xsd-tree generates a string-like type for any use of stage_ref_ex, even if it's a stage_ref_list inside. So here I wanted to ask if it would be possible in the case of a list attribute being used (in a union or not), to provide some kind of iterator that would allow going through the tokens? Obviously I can use my own string tokenizer (like the one in boost or the new split function) but it would be easier to manipulate such type as a list if it is really a list of token. That said I'm not sure about how to provide such feature in such complex context, so I just start a discussion about it, see if you have an idea to implement it? Thanks for your work. Joel Lamotte From boris at codesynthesis.com Wed Jun 20 09:52:38 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 20 09:47:56 2012 Subject: [xsd-users] Attribute list as a C++ list of token In-Reply-To: References: Message-ID: Hi Jo?l, Klaim - Jo?l Lamotte writes: > > > So here I wanted to ask if it would be possible in the case of a list > attribute being used (in a union or not), to provide some kind of iterator > that would allow going through the tokens? XSD maps xs:list to a C++ sequence container. It is xs:union that spoils things. In C++/Tree unions are always mapped to a string. Providing a more elaborate mapping is not trivial and will require full-blown validation to determine which member type it is. So if you want a nice list, try to get rid of the union. Boris From owagh at tower-research.com Thu Jun 21 00:22:47 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Thu Jun 21 00:22:51 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> Message-ID: <4FE2A197.1080705@tower-research.com> Hi Boris. I think I missed out the xsd-users mailing list in my last email so please bear with the repeat email and you can safely ignore the previous one. I'm still having some issues (seg faults to be precise) in certain specific cases. Now, say I have the following in my xml :- 1 451 stop2 Now, if I try to make a copy of some_bigger_unit, then unit1 in the copy no longer points to any element. This, as you pointed out, can be solved by using _container function. Now, if I try to access an even_bigger_unit that points to the say some_bigger_unit with ID="2", then it would run into a problem because now there are two some_bigger_units with the same ID within the same container and it seg faults. I'm using a simple hack wherein I change the ID of the newly created some_bigger_unit but it's certainly not the kind of clean solution I'd like. Is there any other way to do this? Or is the so called "hack" actually the clean solution? Omkar On 06/06/2012 03:20 AM, Boris Kolpackov wrote: > Hi Omkar, > > Omkar Wagh writes: > >> Is there any chance of this becoming an officially supported/documented >> function sometime in the near future? I don't want to use it unless I >> know it is stable and supported. > I don't see this function going away. However, seeing that it is not > expected to be used directly (you are the first person finding it useful), > I think our time is better spend elsewhere rather than documenting its > requirements, etc. > > Boris From owagh at tower-research.com Thu Jun 21 00:31:07 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Thu Jun 21 00:31:09 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: <4FE2A197.1080705@tower-research.com> References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> <4FE2A197.1080705@tower-research.com> Message-ID: <4FE2A38B.8010204@tower-research.com> Hi I suppose if there now were a way to "unset" the container once the job of the temporary is done, that too might work. Omkar On 06/21/2012 12:22 AM, Omkar Wagh wrote: > Hi Boris. > I think I missed out the xsd-users mailing list in my last email so > please bear with the repeat email and you can > safely ignore the previous one. > > I'm still having some issues (seg faults to be precise) in certain > specific cases. > > > > > > > > > > > > > > > > > > > xse:refType="some_bigger_unit" /> > > > > Now, say I have the following in my xml :- > 1 > > my_id="2">451 > > my_id="3">stop2 > > Now, if I try to make a copy of some_bigger_unit, then unit1 in the > copy no longer points to any element. > This, as you pointed out, can be solved by using _container function. > > Now, if I try to access an even_bigger_unit that points to the say > some_bigger_unit with ID="2", then it > would run into a problem because now there are two some_bigger_units > with the same ID within the > same container and it seg faults. > > I'm using a simple hack wherein I change the ID of the newly created > some_bigger_unit but it's certainly not > the kind of clean solution I'd like. > > Is there any other way to do this? Or is the so called "hack" actually > the clean solution? > > Omkar From thomasd57 at yahoo.com Wed Jun 20 16:49:31 2012 From: thomasd57 at yahoo.com (Thomas Daniel) Date: Thu Jun 21 04:25:03 2012 Subject: [xsd-users] Problem building xsde Message-ID: <4FE2375B.7000601@yahoo.com> I downloaded http://www.codesynthesis.com/download/xsde/3.2/xsde-3.2.0+dep.tar.bz2 Since boost and xerces are in non-standard locations, I used the following to build: ------------------------ #!/bin/sh boost=/home/install/boost/boost-1.40.0 xerces=/home/install/xerces-c/xerces-c-3.1.1 make verbose=1 CPPFLAGS="-I$boost/include -I$xerces/include" LDFLAGFS="-L$boost/lib -L$xerces/lib" ------------------------ I get the following error: ranlib /home/tdaniel/xsde-3.2.0+dep/libfrontend-elements/frontend-elements/libfrontend-elements.a echo "/home/tdaniel/xsde-3.2.0+dep/libfrontend-elements/frontend-elements/libfrontend-elements.a" >/home/tdaniel/xsde-3.2.0+dep/libfrontend-elements/frontend-elements/frontend-elements.l echo "`cat /home/tdaniel/xsde-3.2.0+dep/libcult/cult/cult.l`" | xargs -n 1 echo >>/home/tdaniel/xsde-3.2.0+dep/libfrontend-elements/frontend-elements/frontend-elements.l make: *** No rule to make target `-lxerces-c', needed by `/home/tdaniel/xsde-3.2.0+dep/libxsd-frontend/xsd-frontend/xsd-frontend.l'. Stop. From gdomjan at novell.com Wed Jun 20 15:29:05 2012 From: gdomjan at novell.com (Greg Domjan) Date: Thu Jun 21 04:25:07 2012 Subject: [xsd-users] availability as maven plugin & dependency Message-ID: <4FE1EC41.C828.000E.1@novell.com> Hi, I was wondering if the "XSD: XML Data Binding for C++" was made available as * a maven plugin and dependency * a NuGet dependency anywhere, or if you would consider providing it in that form in future? I have not found any mention of maven or NuGet on the parts of your websites that I have searched. I'm just looking at wrapping this up in maven for our internal usage if you don't already do so. regards, Greg Domjan Senior Software Engineer 1919 Gallows Rd Vienna (W) +1 (703) 663 5532 (M) +1 (703) 501 4673 gdomjan@novell.com gdomjan@netiq.com From boris at codesynthesis.com Thu Jun 21 04:33:49 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 21 04:29:00 2012 Subject: [xsd-users] Problem building xsde In-Reply-To: <4FE2375B.7000601@yahoo.com> References: <4FE2375B.7000601@yahoo.com> Message-ID: Hi Thomas, For future questions about XSD/e, please send them to the xsde-users@codesynthesis.com mailing list instead of xsd-users. Thomas Daniel writes: > make verbose=1 CPPFLAGS="-I$boost/include -I$xerces/include" > LDFLAGFS="-L$boost/lib -L$xerces/lib" That should be 'LDFLAGS', not 'LDFLAGFS'. ^ Boris From boris at codesynthesis.com Thu Jun 21 05:00:16 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 21 04:55:27 2012 Subject: [xsd-users] Attribute list as a C++ list of token In-Reply-To: References: Message-ID: Hi Jo?l, [CC'ed xsd-users.] Klaim - Jo?l Lamotte writes: > But then I cannot have either a list of values or a unique special value, > right? Right. The other alternative would be to provide a custom stage_ref_ex class implementation that would determine what kind value it is and parse/serialize accordingly. Something along these lines: class stage_ref_ex: public stage_ref_list { ... bool special () const; void special (bool); private: bool special_; }; Then in the parsing constructor you would check whether the element or attribute text is the special "#all" value. If it is, then you set the special_ flag. Otherwise, you simply delegate to the stage_ref_list parsing c-tor. Similar logic will also need to be implemented in the serialization operator. Boris From boris at codesynthesis.com Thu Jun 21 05:16:33 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 21 05:11:45 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: <4FE2A197.1080705@tower-research.com> References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> <4FE2A197.1080705@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > Now, if I try to access an even_bigger_unit that points to the say > some_bigger_unit with ID="2", then it would run into a problem because > now there are two some_bigger_units with the same ID within the > same container and it seg faults. The ID attribute should be unique in the XML, so this is consistent with that restriction, except for the seg fault Are you sure it is not throwing the duplicate_id exception? In any case, let me tell you how this mechanism work so that you will be able to answer this kind of questions yourself in the future (that's the problem with documenting _container() -- it raises more and more obscure questions unless you know exactly how it is implemented). IDREF in C++/Tree doesn't store a pointer to the node it points to. Rather it stores the value of the ID and whenever you need the pointed-to node, it does a lookup in the ID-to-node map that is stored in the root node of the object model. Whenever a node is added somewhere in the model, its _container() function is called to notify it that it is now part of that model. In _container() the node registers all its IDs in the map. If there is a duplicate, then you get the duplicate_id exception. > I suppose if there now were a way to "unset" the container once the job > of the temporary is done, that too might work. Yes, you can do that by passing NULL pointer to _container(). That's what happens when you detach a node from a model. Boris From mjklaim at gmail.com Thu Jun 21 05:31:22 2012 From: mjklaim at gmail.com (=?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?=) Date: Thu Jun 21 05:31:30 2012 Subject: [xsd-users] Attribute list as a C++ list of token In-Reply-To: References: Message-ID: Thanks for the suggestion. I ended up having lists of unions that are either id or string with special value). It looks easier to just have a list in C++, and just stop processing the list if we encounter a special value. It's ok in the semantic of my format I think, but I'll have to check by use. As always, thanks, your are very useful. (side note: I recently did major changes in my xsd format and was counting on xsd-tree to help me point the broken C++ code -that use the generated code- and I was positively surprised to see how easy the fixes were using this approach. This tool is really super useful in my context! ) Joel Lamotte From boris at codesynthesis.com Thu Jun 21 05:37:45 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 21 05:32:58 2012 Subject: [xsd-users] availability as maven plugin & dependency In-Reply-To: <4FE1EC41.C828.000E.1@novell.com> References: <4FE1EC41.C828.000E.1@novell.com> Message-ID: Hi Greg, Greg Domjan writes: > I was wondering if the "XSD: XML Data Binding for C++" was made available as > * a maven plugin and dependency > * a NuGet dependency No, not at the moment. Both of these tools don't seem to be used very frequently in C++ projects. From NuGet FAQ I see that they only support C#, F# and Visual Basic projects. > Or if you would consider providing it in that form in future? If there is a widespread demand, then we would consider this. So far you are the only person asking. But if you can come up with something like this and would like to contribute it, then that would be welcome! We have a Wiki page that lists instructions/code for integrating XSD with various IDEs, build systems, etc. For example, there are several CMake modules available. Boris From owagh at tower-research.com Thu Jun 21 13:54:59 2012 From: owagh at tower-research.com (Omkar Wagh) Date: Thu Jun 21 13:55:05 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: References: <4FC684D4.5010103@tower-research.com> <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> <4FE2A197.1080705@tower-research.com> Message-ID: <4FE35FF3.8070402@tower-research.com> Hi Boris On 06/21/2012 05:16 AM, Boris Kolpackov wrote: > The ID attribute should be unique in the XML, so this is consistent > with that restriction, except for the seg fault Are you sure it is > not throwing the duplicate_id exception? I am quite sure of this. Setting the ID of the temporary some_bigger_unit (which has an IDREF as a member element) to some random (hopefully unique) value avoids the segfault the next time I want to dereference an IDREF to the same some_bigger_unit. It definitely doesn't throw an exception but segfaults when I try to do the second dynamic cast. > IDREF in C++/Tree doesn't store a pointer to the node it points > to. Rather it stores the value of the ID and whenever you need > the pointed-to node, it does a lookup in the ID-to-node map > that is stored in the root node of the object model. Whenever > a node is added somewhere in the model, its _container() > function is called to notify it that it is now part of that model. > In _container() the node registers all its IDs in the map. If > there is a duplicate, then you get the duplicate_id exception. This is somewhat how I thought it works after going through the library source code. Thanks for clearing it all up. >> I suppose if there now were a way to "unset" the container once the job >> of the temporary is done, that too might work. > Yes, you can do that by passing NULL pointer to _container(). That's > what happens when you detach a node from a model. I tried this out but then I get a different exception :- terminate called after throwing an instance of 'xsd::cxx::tree::_type::not_registered' what(): attempt to unregister non-existent id Aborted Omkar From boris at codesynthesis.com Fri Jun 22 06:02:16 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 22 05:57:16 2012 Subject: [xsd-users] copying IDREF elements classes In-Reply-To: <4FE35FF3.8070402@tower-research.com> References: <4FC78607.50203@tower-research.com> <4FC8E0C2.8030200@tower-research.com> <4FCE5991.3010007@tower-research.com> <4FE2A197.1080705@tower-research.com> <4FE35FF3.8070402@tower-research.com> Message-ID: Hi Omkar, Omkar Wagh writes: > > Are you sure it is not throwing the duplicate_id exception? > > I am quite sure of this. > > [...] > > I tried this out but then I get a different exception Can you create a small test case that reproduces both of these problems (the 'library' example uses IDREFs so it can probably work as a base)? Then I could take a look. Bris From D.Gavrila at gematronik.com Thu Jun 28 07:20:27 2012 From: D.Gavrila at gematronik.com (Gavrila, Daniel) Date: Thu Jun 28 07:20:37 2012 Subject: [xsd-users] compiling WXXM schema Message-ID: Hello , I'm in the evaluation phase of XSD product and looks very impressive. I'm trying to compile the WXXM schema(version 1.1.1) published here https://wiki.ucar.edu/display/NNEWD/WXXM The WXXM schema is based on GML schema. My command line for compiling just the units.xsd file from the wx subfolder is: $ xsd cxx-tree --output-dir gen --location-map http://schemas.opengis.net/gml/3.2.1/gml.xsd=/c/Sesar/gml-3.2.1-split-code/gml/3.2.1/gml.xsd wx/units.xsd and I got these errors : c:\Sesar\gml-3.2.1-split-code\gml\3.2.1\gmlBase.xsd:15:49: warning F001: element 'AbstractObject' is implicitly of anyType c:\Sesar\gml-3.2.1-split-code\gml\3.2.1\gmlBase.xsd:15:49: info: did you forget to specify 'type' attribute? c:\Sesar\gml-3.2.1-split-code\gml\3.2.1\..\..\iso\19139\20070417\gmd\..\gmd\..\gco\..\gco\basicTypes.xsd:379:29: warning F001: element 'Record' is implicitly of anyType c:\Sesar\gml-3.2.1-split-code\gml\3.2.1\..\..\iso\19139\20070417\gmd\..\gmd\..\gco\..\gco\basicTypes.xsd:379:29: info: did you forget to specify 'type' attribute? gen\units.hxx: error: unable to open in write mode Another problem: I 've tried to compile also the GML schema in this environment Windows 7/MinGW , gcc 4.7 with the help of makefile from the archive gml-3.2.1-split-code and I got in the linking phase this error: gen\gml\PassThroughOperationPropertyType.o: file not recognized: Memory exhausted collect2.exe: error: ld returned 1 exit status make: *** [driver] Error 1 Is a problem with my PC or something else ? Many thanks, Daniel Gavrila Meteorological Information System Selex Systems Integration GmbH Gematronik Weather Radar Systems Raiffeisenstr. 10 41470 Neuss GERMANY Tel.: +49-2137-782-138 Fax.: +49-2137-782-287 d.gavrila@gematronik.com www.gematronik.com www.selex-si.de Selex Systems Integration GmbH Sitz der Gesellschaft / Registered Office: Neuss Registergericht / Register Court: Neuss HR B 1242 Gesch?ftsf?hrer / Managing Director: Ulrich Nellen From boris at codesynthesis.com Thu Jun 28 09:51:36 2012 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 28 09:45:33 2012 Subject: [xsd-users] compiling WXXM schema In-Reply-To: References: Message-ID: Hi Daniel, Gavrila, Daniel writes: > I'm in the evaluation phase of XSD product and looks very impressive. Thank you. > $ xsd cxx-tree --output-dir gen ... > > gen\units.hxx: error: unable to open in write mode Probably because there is no 'gen' directory in the current directory. > I 've tried to compile also the GML schema in this environment Windows > 7/MinGW, gcc 4.7 with the help of makefile from the archive gml-3.2.1- > split-code and I got in the linking phase this error: > > gen\gml\PassThroughOperationPropertyType.o: file not recognized: Memory > exhausted collect2.exe: error: ld returned 1 exit status I did some web searches and this error appears to be caused by linker running out of memory. This thread has some suggestions: http://sourceforge.net/mailarchive/message.php?msg_id=28251694 In particular, increasing the amount of RAM (either by installing more or by closing some applications) seems to work. I tried to compile your schema on my Linux box. Here is what I did: 1. Copy wxxm schema to the gml-3.2.1-split-code so that we have wxxm/wx/*.xsd and wxxm/avwx/*.xsd. 2. Create wxxm/wx and wxxm/avwx directories in the gen directory. 3. Create wxxm.options file in gml-3.2.1-split-code with the following content: --polymorphic-type-all --location-map http://schemas.opengis.net/gml/3.2.1/gml.xsd=../../gml/3.2.1/gml.xsd --include-regex %../../gml/3.2.1/(.+)%../../gml/$1% --namespace-map http://www.opengis.net/gml/3.2=gml32 --namespace-map http://www.eurocontrol.int/wx/1.1=wx11 --namespace-map http://www.eurocontrol.int/avwx/1.1=avwx11 --extern-xml-schema xml-schema.xsd 4. cd to wxxm/wx directory and run the XSD compiler like this: xsd cxx-tree --options-file ../../common.options --options-file ../../wxxm.options --output-dir ../../gen/wxxm/wx units.xsd 5. cd to the gen/wxxm/wx directory (there we should have units.?xx files) and run the C++ compiler like this: g++ -I../.. -c units.cxx I also tried to compile other schema files in wx and avwx, but they seem to depend on yet other schemas. Boris