Hi Adam

Without seeing the schema in full it's hard to tell, but here's my
guess. I guess that you've declared the <mediumName> element as a local
element in the schema (this will happen if it is not an immediate child
of the top-level <schema> element).

How you refer to local elements and specifically whether you should
include a namespace prefix or not is controlled by the form attribute on
the element's declaration in the schema. If the form attribute is
missing then it's controlled by the elementFormDefault attribute on the
surrounding <schema> element. The default in both these cases (and
therefore what will happen if they are both missing) is "unqualified".
This means that local elements _must_ be referred to without a
namespace. I'm guessing that this is what has happened in your case.

If the form value is "unqualified" then it is an error to refer to the
local element using a namespace prefix and the validator correctly
points this out.

It sounds like you have control over the schema. If so then you can
change it so that either that specific element declaration has
form="qualified" or you can set the same rule for the whole schema by
setting elementFormDefault="qualified" in the <schema> element instead.

Note that it is equally an error for you to be expecting a namespace and
not to see one - so if you update your schema in this way be sure that
all clients know about it and will ensure that all local elements are
namespace qualified in all the instance documents.

Cheers,

Lawrence

> -----Original Message-----
> From: Adam Hardy [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 20, 2005 6:08 AM
> To: [email protected]
> Subject: Namespace prefix throws spanner in works
> 
> Hi,
> 
> I hope someone give me a clue how to proceed with this issue: I
compiled
> a set of beans against my schema and now I'm using them in my app.
> 
> I parse an XML doc into the document, and then when I call
> doc.validate(), I get a series of validation errors.
> 
> My xml header looks like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <epg xmlns:epg="http://www.worlddab.org/schemas/epg";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xsi:schemaLocation="http://www.worlddab.org/schemas/epg
> epgSchedule_11.xsd"
>       system="DAB">
> Etc etc
> 
> And the xml where the first error occurs looks like this:
> 
> <programme shortId="59033">
>       <epg:mediumName>PM</epg:mediumName>
>       [snip...]
> </programme>
> 
> And the error says:
> 
> Expected element mediumName at the end of the content in element
> programme
> 
> If I remove the epg: namespace prefix from the elements, then it
> validates fine, but I can't do that in the live environment - the app
> will receive these xml files from an outside source.
> 
> The 'programme' element is defined in my epgSchedule_11.xsd which is
> referenced as you can see above in the xml root element. The
mediumName
> element is defined in a separate schema which the epgSchedule_11.xsd
> schema includes.
> 
> I have researched extensively across the xmlbeans site, the mailing
> lists and google, but can't find my problem - I guess it's a case of
not
> seeing the wood for the trees. Hopefully someone can help.
> 
> Thanks a lot
> Adam
> 
> http://www.bbc.co.uk/
> 
> This e-mail (and any attachments) is confidential and may contain
> personal views which are not the views of the BBC unless specifically
> stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in
> reliance on it and notify the sender immediately. Please note that the
> BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to