W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2008

Re: Schema Instance why does xmlns attribute causes problem?

From: Joseph Pecoraro <joepeck02@gmail.com>
Date: Thu, 13 Nov 2008 18:16:44 -0500
Cc: <xmlschema-dev@w3.org>
Message-Id: <6913DC5A-7394-4E2B-A559-57703CF2A802@gmail.com>
To: "Michael Kay" <mike@saxonica.com>
Hey Michael,

Thanks for the quick answer, this one was really giving me a headache.
I was not thinking about things that way.  Its much clearer now =).

Thanks!
- Joe

On Nov 13, 2008, at 1: 45PM, Michael Kay wrote:

> A test element in no namespace and a test element in namespace http://people.rit.edu/~jjp1820/770/project/xtml_test 
>  are as different as chalk and cheese - literally. They have  
> competely unrelated names. A schema defines rules for validating an  
> element of a particular name, and if you change the element's name,  
> the rules don't apply. And the namespace is part of the name, just  
> as your surname is part of your name.
>
> Michael Kay
> http://www.saxonica.com/
>
> From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org 
> ] On Behalf Of Joseph Pecoraro
> Sent: 13 November 2008 17:29
> To: xmlschema-dev@w3.org
> Subject: Schema Instance why does xmlns attribute causes problem?
>
> Hello,
>
> I have a quick question.  I'm trying to validate an XML document using
> a Schema and I ran into an issue.  I can't tell, based on the  
> specification
> why what I have appears invalid.
>
> I have the following:
>
> <test test_id="1"
>     xmlns="http://people.rit.edu/~jjp1820/770/project/xtml_test"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://people.rit.edu/~jjp1820/770/project/xtml_test
>                         http://people.rit.edu/~jjp1820/770/project/xtml_test.xsd 
> ">
>
> Which appears invalid in the tool that I'm using.
>
> But, Once I remove the plain xmlns attribute and get the following
> which appears valid:
>
> <test test_id="1"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://people.rit.edu/~jjp1820/770/project/xtml_test
>                         http://people.rit.edu/~jjp1820/770/project/xtml_test.xsd 
> ">
>
> I would like to know why the top, previous example is "invalid."  To  
> me,
> it means the exact same thing, but its slightly redundant.  I will  
> certainly
> use the bottom from now on, but I would be interested in knowing
> how, why, or even if the top syntax is invalid.
>
> Thanks guys,
> Joseph Pecoraro
>
Received on Thursday, 13 November 2008 23:17:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:09 GMT