Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
263
XSD schemaLocation
NOTE: The XSD tool does not honor the schemaLocation hint on the
<import> tag. You have to list all referenced schemas explicitly on the
command line. This is not necessary for schemas referenced by an
<include> tag.
You probably noticed that both schemas previously listed declared a
top-level element car. By default, the tool generates the class corresponding
to the type the first time it encounters an element definition referencing the
complexType. In this example, the first element to reference the type is the
car element in the car.xsd schema hence xsd.exe creates a class definition
referencing the urn:christoph-cars namespace:
7 Listing C.7
Car class generated from the car schema.
(annotation) <#1 The attributes specify the namespace from the schema in
car.xsd.>
(annotation) <#2 The XmlRootAttribute maps the car_t class to a car
element in an XML document. >
(annotation) <#3 The class name is based on the type name, not the
element name.>
If we need to create a car class corresponding to the car element from the
urn:christoph-garage namespace we have to explicitly select the namespace with
the /u switch:
When this switch is present on the command-line, the tool will extract all
top-level elements belonging to the specified namespace. The generated car
class now maps to the car element in the garage schema: