CodeSynthesis C++Tree 'time' in namespace '::' does not name a type

390 Views Asked by At

I'm trying to use CodeSynthesis C++/Tree to translate a xsd into C++ classes. In the xsd I have an element named time looks like this:

<xs:element name="time">
<xs:complexType>
  <xs:attribute name="seconds" use="required" type="xs:double"/>
  ... other attributes
</xs:complexType>

In the converted C++ header it's defined as:

typedef ::time time_type;

and when compiling it gives me an error message saying

'time' in namespace '::' does not name a type

However if I change the element's name to 'times' or anything else, it would compile fine. What could possibly be the reason behind this behavior? Many thanks!

2

There are 2 best solutions below

2
On BEST ANSWER

It's because ::time is the same as std::time.

0
On

Okay, now I read a little bit more on the documentation, it says

"A vocabulary without a namespace is mapped to the global scope. This also can be altered with the above options by using an empty name for the XML namespace:"

So the solution is to add the following when converting xsd to C++ files

--namespace-map =cs