Hi Adam

Re your question on which elementFormDefault applies (1) or (2) -
unfortunately for you it's the one in the schema element surrounding the
local declaration of mediumName in the scheduleNameGroup model group
definition. So the "unqualified" treatment required by (2) is correct.

I have some sympathy with your other comments as I prefer the
elementFormDefault="qualified" setup myself. But having said that,
elementFormDefault="unqualified" is not illegal. And it's not as if the
attribute has been forgotten (and therefore defaulted); rather the
schema designers have explicitly chosen to make it unqualified.

It is the responsibility of whoever constructs the instance document to
conform to the schema so, technically, whoever is providing you with
your instance doc is providing invalid XML which should be rejected and
you should contact them to fix it. But if you're happy having your local
copy of the schema then so be it.

Cheers,

Lawrence

> -----Original Message-----
> From: Adam Hardy [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 23, 2005 2:57 AM
> To: user@xmlbeans.apache.org
> Subject: RE: Namespace prefix throws spanner in works
> 
> The schemas are in public domain so I can edit neither the schema nor
> the incoming XML :(
> 
> (1) http://www.worlddab.org/schemas/epg/epgSchedule_11.xsd
> (2) http://www.worlddab.org/schemas/epg/epgDataTypes_11.xsd
> 
> 
> You are correct about the elementFormDefault="unqualified" on the
> imported schema (2), however in the actual schema (1) it is set to
> "qualified", which would be this element's 'surrounding schema'. Does
> this make no difference?
> 
> As far as my project is concerned, I can keep a local copy of the
schema
> and change that elementFormDefault. That will sort out my xml beans
> validation.
> 
> Truth be told this is actually the second change we have to make to
the
> schema, which points a finger at the WorldDAB committee who wrote it.
I
> did email them when I had to make the first change but received no
> reply. Oh well.
> 
> Thanks for the help :)
> 
> 
> Adam
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Lawrence Jones [mailto:[EMAIL PROTECTED]
> > Sent: 20 May 2005 17:44
> > To: user@xmlbeans.apache.org
> > Subject: RE: Namespace prefix throws spanner in works
> >
> >
> > 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: user@xmlbeans.apache.org
> > > 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.
> 
> 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