[xsd-users] RE: Access Violation when deleting objects

bruno.marotta at fortis.com bruno.marotta at fortis.com
Wed Nov 14 07:39:02 EST 2007


Hi Boris,

thanks again for the prompt replying, ant thanks again for spending your time with my requests. 

I think that the idea of having another contructor will be great. But it will be better to have an option for not creating empty classes like this one. For instance, my schema is something like this:

...
<xs:element name="Asset" maxOccurs="unbounded">
	<xs:complexType>
		<xs:sequence>
			<xs:element name="ObligorID">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:minLength value="1"/>
						<xs:whiteSpace value="collapse"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>
			...
 
How does XSD works today: 
	- Creates the Asset object, 
	- Creates the ObligorID object with some functions and no implemenation (only for clone), 
	- Creates the Asset::Obligor_ID type equals to ObligorID
	- Creates the getters and setters of Asset::ObligorID

What I am suggesting is to have an option --DoNotCreateClassForSimpleElements, meaning, if an element is just a string, a double or whatever type that can be easily mapped to one of the xml_schema basic types, have no childs and no enumeration restrictions, there is actual no need for creating a class with no implementation on it. 

How should XSD work when this option is on for the example above:
	- Creates the Asset object, 
	- Creates the Asset::Obligor_ID type equals to xml_schema::string
	- Creates the getters and setters of Asset::ObligorID

This will not only solve the bellow mentioned issue, but will also reduce a lot the size and complexity of the generated code.

What do you think?!

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, November 14, 2007 1:04 PM
To: Marotta Bruno
Cc: xsd-users at codesynthesis.com
Subject: Re: Access Violation when deleting objects

Hi Bruno,

bruno.marotta at fortis.com <bruno.marotta at fortis.com> writes:

> About the string question as you may see here bellow the
> AssumedRecoveryLookup is a pure and simple string class.
> And it is only used on the asset class. So, why must it
> be a class and just a simple property from the Asset with
> type xml_schema::string? Isn't the transformation adding
> too much code for nothing?

Well, your schema defines AssumedRecoveryLookup by inheriting
from xsd:string but without adding any attributes or elements
to it. If you want your AssumedRecoveryLookup attribute/element
to have xml_schema::string as a type, then use xsd:string in
your schema. In other words, XSD cannot read your mind and
figure out when you want a proper type generated and when you
want a base class to be used instead.

Having said that, we are going to add generation of an extra
constructor for types like AssumedRecoveryLookup so that you
can pass a string literal instead of explicitly constructing
and instance.

Boris


= = = = = = = = = = = = = = = = = = = = = = = = =
Fortis disclaimer :
http://www.fortis.be/legal/disclaimer.htm

Privacy policy related to banking activities of Fortis:
http://www.fortis.be/legal/privacy_policy.htm
= = = = = = = = = = = = = = = = = = = = = = = = =






More information about the xsd-users mailing list