[xsd-users] namespace mapping

Boris Kolpackov boris at codesynthesis.com
Tue Jun 24 14:41:28 EDT 2008


Hi Ray,

Rizzuto, Raymond <Raymond.Rizzuto at sig.com> writes:

>         xml_schema::NamespaceInfomap map;
>         map[""].name = "";
>         map[""].schema = "SDMP-1.1.XSD";
>         message(std::cout, m, map);
> 
> [...]
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>            xmlns="http://sig.com/sdmp/messages" 
>            targetNamespace="http://sig.com/sdmp/messages" 
>            elementFormDefault="qualified" 
>            attributeFormDefault="unqualified" version="1.1">

You get this exception because your vocabulary uses the 
http://sig.com/sdmp/messages namespace however you haven't provided
the prefix-namespace mapping for it.

I also think you are confusing the namespace part in the schemaLocation
attribute with the place where the schema is located. In reality the
namespace part should be the same as the targetNamespace attribute in
your schema (only if your schema does not have targetNamespace should
you be using noNamespaceSchemaLocation). The actual schema name can
contain an absolute path (or even a remote URI), for example:

schemaLocation="http://sig.com/sdmp/messages http://sig.com/SDMP-1.1.XSD"

If the schema name is not a URI then it is resolved relative to the
location of the XML document that contains the schemaLocation attribute
(note that the namespace part is not used to locate the schema).

There is also a number of ways to override the schema location information
that comes from XML documents. For more information on this 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




More information about the xsd-users mailing list