[OpenLayers-Users] WFS-T update problem with namespaces

Andrea Aime aaime at openplans.org
Wed Jun 4 14:35:21 EDT 2008


Christopher Schmidt ha scritto:
> On Wed, Jun 04, 2008 at 08:09:24PM +0200, Andrea Aime wrote:
>> Yeah, the error comes up from Xerces-J during the xml validation, it
>> should be something like the following (I used another layer):
>>
>> Invalid request
>> UndeclaredPrefix: Cannot resolve 'topp:tasmania_roads' as a QName: the 
>> prefix 'topp' is not declared.
>> cvc-attribute.3: The value 'topp:tasmania_roads' of attribute 'typeName' 
>> on element 'wfs:Update' is not valid with respect to its type.
>>
>> The problem is that typeName is an xs:QName, and its namespace must
>> be declared in order for the XML to be schema compliant.
> 
> You've got to be kidding me. 

I'm not... I did not make up that error message, the xml parser is 
throwing it the moment you enable the schema validation.

> I don't even know if there's a way to *do*
> this in any of the OpenLayers code: I don't think the browser DOM
> neccesarily has a way to add namespaces which aren't actually used in
> the XML... Tim would probably know more. (I know I can't do it from my
> Python XML parser/creator, but that's obviously a slightly different
> case.)

The issue is with the xs:QName usage as an attribute. See this book:
http://books.xmlschemata.org/relaxng/ch19-77287.html

"he lexical space of xsd:QName is a qualified name according to 
Namespaces in XML. It is a local name (which is an xsd:NCName) with an 
optional prefix (itself an xsd:NCName), separated by a colon. The prefix 
is declared a namespace prefix in the scope of the element carrying the 
value. Its value space comprises the pairs (namespace URI, local name) 
in which the namespace URI is the URI associated to the prefix in the 
namespace declaration."

and:

"W3C XML Schema itself has already provided some examples of QNames. 
When I wrote "<xsd:attribute name="lang" type="xsd:language"/>", the 
type attribute was a xsd:QName, and its value was the tuple 
{"http://www.w3.org/2001/XMLSchema", "language"}, because the URI 
"http://www.w3.org/2001/XMLSchema" had been assigned to the prefix 
"xsd:". If there is no namespace declaration for this prefix, the type 
attribute is considered invalid."

See also:
http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#QName

Cheers
Andrea



More information about the Users mailing list