You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Kelly Beard <ke...@gmail.com> on 2013/01/08 21:31:20 UTC

Almost in tears (XSD import problems)

I had a dream to make an XSD that contains my most commonly used XML types
and have them contained in an XSD that I could import into other XSDs that
represented by other form types.  The namespace I chose for my types XSD is
DFCTypes.  The other XSD/XML forms would have their own namespaces.

Here's the thing: I think I'm doing everything correctly.  I have a generic
program that I adapted from one of the Xerces samples.  It just reads in an
XML document and spits things out based on the events (startDocument,
endElement, et al).  I use it to validate a new XSD and run test XML
documents through it to see that the parser isn't going to have problems.

This sample program has one thing not in common with how I set up my real
production stuff: an entity resolver set with setEntityResolver().  The
sample validator program flies through an XML validated with an XSD that
does an <xs:import>.  In my production stuff however, I get errors like
these:

Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML element=,
Imported schema 'DFCTypes.xsd' has a different target NameSpace '
http://www.quikq.com/xsd/rfidLog' from what's declared '
http://www.quikq.com/DFCTypes'

Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
element=, Schema Representation Constraint: Namespace '
http://www.quikq.com/DFCTypes' is referenced without <import> declaration

Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
element=, Schema Representation Constraint: Namespace '
http://www.quikq.com/DFCTypes' is referenced without <import> declaration

Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
element=, Schema Representation Constraint: Namespace '
http://www.quikq.com/DFCTypes' is referenced without <import> declaration

The first error regarding "line=7" is about the <xs:import> statement
itself.  There's nothing wrong with it, I swear!

<xs:import namespace="http://www.quikq.com/DFCTypes"
schemaLocation="DFCTypes.xsd" />

That is the namespace I want to use and that is the file that those types
are contained in.  Works fine on my validator program - squat on production
stuff.  Notice the error message says that the namespaces in the target XSD
don't match - bullcrap!

Is anyone interested in helping me out here?  I'm sure the entity stuff is
the problem.  I don't know why I need an entity resolver.  I can post
whatever code you'd like to see.

Thanks!

-- 
Kelly Beard

Re: Almost in tears (XSD import problems)

Posted by Siva Chandran P <si...@gmail.com>.
Please try downloading it from here
https://docs.google.com/file/d/0BwFnTaKxVkxZUDJTcXBpcHJESFU/edit

About EntityResolver, you need to return the XML schema based on the
systemId. Try printing the systemId then you will know how resolveEntity
function is called for various schema files.


Thanks & Regards,
Siva Chandran P


On Thu, Jan 10, 2013 at 10:43 PM, Kelly Beard <ke...@gmail.com>wrote:

> Is anyone getting Siva's attachment?  I see mine, but not his.
>
> So, what is the correct solution to the EntityResolver object?
>
>
> On Thu, Jan 10, 2013 at 10:33 AM, Siva Chandran P <
> siva.chandran.p@gmail.com
> > wrote:
>
> > Hi,
> >
> > I think I know the reason behind the errors, you hard coded the schema
> > file name as "rfidLog.xsd" in your RfidLogResolver. So when the parser
> > processes the "rfidLog.xsd" it will see the import for "DFCTypes.xsd" and
> > will request your RfidLogResolver for source. But as you hard coded the
> > file name, the entity resolver will again return "rfidLog.xsd". That is
> the
> > reason it is saying "Imported schema 'DFCTypes.xsd' has a different
> > target NameSpace 'http://www.quikq.com/xsd/rfidLog' from what's
> declared '
> > http://www.quikq.com/DFCTypes'"
> >
> > BTW, I've attached the corrected file again .
> >
> > Thanks & Regards,
> > Siva Chandran P
> >
> >
> > On Thu, Jan 10, 2013 at 9:56 PM, Kelly Beard <kenverybigliar@gmail.com
> >wrote:
> >
> >> BTW, Siva, I didn't see your corrected XSD.  I'm using the gmail
> >> interface.
> >>
> >>
> >> On Thu, Jan 10, 2013 at 10:15 AM, Kelly Beard <kenverybigliar@gmail.com
> >> >wrote:
> >>
> >> > I've learned XML/XSD piecemeal.  I feel like I need to start over at
> the
> >> > beginning sometimes to fill in all of the knowledge holes.  Anyone
> have
> >> a
> >> > good resource to do this?
> >> >
> >> > In any case, I've attached a file that has two pieces of my code.  I
> can
> >> > give you all more if it will help.  I'll look at your suggestions.
> >>  Thanks
> >> > for mentioning XML Notepad too.  I'll put that utility through it's
> >> paces.
> >> >
> >> > Thanks again guys!
> >> >
> >> >
> >> > On Thu, Jan 10, 2013 at 8:31 AM, Siva Chandran P <
> >> > siva.chandran.p@gmail.com> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I am not sure why you are getting the error at line 7, probably you
> can
> >> >> show us the source of entity resolver and how you are configuring the
> >> >> parser.
> >> >>
> >> >> I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
> >> >> validation.
> >> >>
> >> >> Line 78, Column 18: Type 'subNumType' is not declared, or is not a
> >> simple
> >> >> type.
> >> >> Line 78, Column 18: Namespace '' is not available to be referenced in
> >> >> this schema.
> >> >>
> >> >> Looks like you need to use namespace prefix even for the types that
> are
> >> >> defined just above. Please find the attached corrected xsd.
> >> >>
> >> >> Thanks & Regards,
> >> >> Siva Chandran P
> >> >>
> >> >>
> >> >> On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <
> kenverybigliar@gmail.com
> >> >wrote:
> >> >>
> >> >>> Thanks.  I had to put some things back.  Like I said, I'm blaming
> >> adding
> >> >>> an entityResolver here because thats the only variable I can find.
> >> >>>
> >> >>>
> >> >>>  On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net>
> >> wrote:
> >> >>>
> >> >>>> Can you put a sample of your XML/Xsd  files online in a zip file
> >> >>>> somewhere, then I can have a look when. I've got a few mins spare..
> >> >>>>
> >> >>>> -b
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com>
> >> wrote:
> >> >>>>
> >> >>>> > I had a dream to make an XSD that contains my most commonly used
> >> XML
> >> >>>> types
> >> >>>> > and have them contained in an XSD that I could import into other
> >> XSDs
> >> >>>> that
> >> >>>> > represented by other form types.  The namespace I chose for my
> >> types
> >> >>>> XSD is
> >> >>>> > DFCTypes.  The other XSD/XML forms would have their own
> namespaces.
> >> >>>> >
> >> >>>> > Here's the thing: I think I'm doing everything correctly.  I
> have a
> >> >>>> generic
> >> >>>> > program that I adapted from one of the Xerces samples.  It just
> >> reads
> >> >>>> in an
> >> >>>> > XML document and spits things out based on the events
> >> (startDocument,
> >> >>>> > endElement, et al).  I use it to validate a new XSD and run test
> >> XML
> >> >>>> > documents through it to see that the parser isn't going to have
> >> >>>> problems.
> >> >>>> >
> >> >>>> > This sample program has one thing not in common with how I set up
> >> my
> >> >>>> real
> >> >>>> > production stuff: an entity resolver set with
> setEntityResolver().
> >> >>>>  The
> >> >>>> > sample validator program flies through an XML validated with an
> XSD
> >> >>>> that
> >> >>>> > does an <xs:import>.  In my production stuff however, I get
> errors
> >> >>>> like
> >> >>>> > these:
> >> >>>> >
> >> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
> >> >>>> element=,
> >> >>>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
> >> >>>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
> >> >>>> > http://www.quikq.com/DFCTypes'
> >> >>>> >
> >> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95,
> XML
> >> >>>> > element=, Schema Representation Constraint: Namespace '
> >> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >> >>>> declaration
> >> >>>> >
> >> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97,
> XML
> >> >>>> > element=, Schema Representation Constraint: Namespace '
> >> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >> >>>> declaration
> >> >>>> >
> >> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97,
> XML
> >> >>>> > element=, Schema Representation Constraint: Namespace '
> >> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >> >>>> declaration
> >> >>>> >
> >> >>>> > The first error regarding "line=7" is about the <xs:import>
> >> statement
> >> >>>> > itself.  There's nothing wrong with it, I swear!
> >> >>>> >
> >> >>>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
> >> >>>> > schemaLocation="DFCTypes.xsd" />
> >> >>>> >
> >> >>>> > That is the namespace I want to use and that is the file that
> those
> >> >>>> types
> >> >>>> > are contained in.  Works fine on my validator program - squat on
> >> >>>> production
> >> >>>> > stuff.  Notice the error message says that the namespaces in the
> >> >>>> target XSD
> >> >>>> > don't match - bullcrap!
> >> >>>> >
> >> >>>> > Is anyone interested in helping me out here?  I'm sure the entity
> >> >>>> stuff is
> >> >>>> > the problem.  I don't know why I need an entity resolver.  I can
> >> post
> >> >>>> > whatever code you'd like to see.
> >> >>>> >
> >> >>>> > Thanks!
> >> >>>> >
> >> >>>> > --
> >> >>>> > Kelly Beard
> >> >>>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Kelly Beard
> >> >>>
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Kelly Beard
> >> >
> >>
> >>
> >>
> >> --
> >> Kelly Beard
> >>
> >
> >
>
>
> --
> Kelly Beard
>

Re: Almost in tears (XSD import problems)

Posted by Kelly Beard <ke...@gmail.com>.
Is anyone getting Siva's attachment?  I see mine, but not his.

So, what is the correct solution to the EntityResolver object?


On Thu, Jan 10, 2013 at 10:33 AM, Siva Chandran P <siva.chandran.p@gmail.com
> wrote:

> Hi,
>
> I think I know the reason behind the errors, you hard coded the schema
> file name as "rfidLog.xsd" in your RfidLogResolver. So when the parser
> processes the "rfidLog.xsd" it will see the import for "DFCTypes.xsd" and
> will request your RfidLogResolver for source. But as you hard coded the
> file name, the entity resolver will again return "rfidLog.xsd". That is the
> reason it is saying "Imported schema 'DFCTypes.xsd' has a different
> target NameSpace 'http://www.quikq.com/xsd/rfidLog' from what's declared '
> http://www.quikq.com/DFCTypes'"
>
> BTW, I've attached the corrected file again .
>
> Thanks & Regards,
> Siva Chandran P
>
>
> On Thu, Jan 10, 2013 at 9:56 PM, Kelly Beard <ke...@gmail.com>wrote:
>
>> BTW, Siva, I didn't see your corrected XSD.  I'm using the gmail
>> interface.
>>
>>
>> On Thu, Jan 10, 2013 at 10:15 AM, Kelly Beard <kenverybigliar@gmail.com
>> >wrote:
>>
>> > I've learned XML/XSD piecemeal.  I feel like I need to start over at the
>> > beginning sometimes to fill in all of the knowledge holes.  Anyone have
>> a
>> > good resource to do this?
>> >
>> > In any case, I've attached a file that has two pieces of my code.  I can
>> > give you all more if it will help.  I'll look at your suggestions.
>>  Thanks
>> > for mentioning XML Notepad too.  I'll put that utility through it's
>> paces.
>> >
>> > Thanks again guys!
>> >
>> >
>> > On Thu, Jan 10, 2013 at 8:31 AM, Siva Chandran P <
>> > siva.chandran.p@gmail.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> I am not sure why you are getting the error at line 7, probably you can
>> >> show us the source of entity resolver and how you are configuring the
>> >> parser.
>> >>
>> >> I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
>> >> validation.
>> >>
>> >> Line 78, Column 18: Type 'subNumType' is not declared, or is not a
>> simple
>> >> type.
>> >> Line 78, Column 18: Namespace '' is not available to be referenced in
>> >> this schema.
>> >>
>> >> Looks like you need to use namespace prefix even for the types that are
>> >> defined just above. Please find the attached corrected xsd.
>> >>
>> >> Thanks & Regards,
>> >> Siva Chandran P
>> >>
>> >>
>> >> On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <kenverybigliar@gmail.com
>> >wrote:
>> >>
>> >>> Thanks.  I had to put some things back.  Like I said, I'm blaming
>> adding
>> >>> an entityResolver here because thats the only variable I can find.
>> >>>
>> >>>
>> >>>  On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net>
>> wrote:
>> >>>
>> >>>> Can you put a sample of your XML/Xsd  files online in a zip file
>> >>>> somewhere, then I can have a look when. I've got a few mins spare..
>> >>>>
>> >>>> -b
>> >>>>
>> >>>>
>> >>>>
>> >>>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com>
>> wrote:
>> >>>>
>> >>>> > I had a dream to make an XSD that contains my most commonly used
>> XML
>> >>>> types
>> >>>> > and have them contained in an XSD that I could import into other
>> XSDs
>> >>>> that
>> >>>> > represented by other form types.  The namespace I chose for my
>> types
>> >>>> XSD is
>> >>>> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
>> >>>> >
>> >>>> > Here's the thing: I think I'm doing everything correctly.  I have a
>> >>>> generic
>> >>>> > program that I adapted from one of the Xerces samples.  It just
>> reads
>> >>>> in an
>> >>>> > XML document and spits things out based on the events
>> (startDocument,
>> >>>> > endElement, et al).  I use it to validate a new XSD and run test
>> XML
>> >>>> > documents through it to see that the parser isn't going to have
>> >>>> problems.
>> >>>> >
>> >>>> > This sample program has one thing not in common with how I set up
>> my
>> >>>> real
>> >>>> > production stuff: an entity resolver set with setEntityResolver().
>> >>>>  The
>> >>>> > sample validator program flies through an XML validated with an XSD
>> >>>> that
>> >>>> > does an <xs:import>.  In my production stuff however, I get errors
>> >>>> like
>> >>>> > these:
>> >>>> >
>> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
>> >>>> element=,
>> >>>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
>> >>>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
>> >>>> > http://www.quikq.com/DFCTypes'
>> >>>> >
>> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
>> >>>> > element=, Schema Representation Constraint: Namespace '
>> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> >>>> declaration
>> >>>> >
>> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
>> >>>> > element=, Schema Representation Constraint: Namespace '
>> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> >>>> declaration
>> >>>> >
>> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
>> >>>> > element=, Schema Representation Constraint: Namespace '
>> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> >>>> declaration
>> >>>> >
>> >>>> > The first error regarding "line=7" is about the <xs:import>
>> statement
>> >>>> > itself.  There's nothing wrong with it, I swear!
>> >>>> >
>> >>>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
>> >>>> > schemaLocation="DFCTypes.xsd" />
>> >>>> >
>> >>>> > That is the namespace I want to use and that is the file that those
>> >>>> types
>> >>>> > are contained in.  Works fine on my validator program - squat on
>> >>>> production
>> >>>> > stuff.  Notice the error message says that the namespaces in the
>> >>>> target XSD
>> >>>> > don't match - bullcrap!
>> >>>> >
>> >>>> > Is anyone interested in helping me out here?  I'm sure the entity
>> >>>> stuff is
>> >>>> > the problem.  I don't know why I need an entity resolver.  I can
>> post
>> >>>> > whatever code you'd like to see.
>> >>>> >
>> >>>> > Thanks!
>> >>>> >
>> >>>> > --
>> >>>> > Kelly Beard
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Kelly Beard
>> >>>
>> >>
>> >>
>> >
>> >
>> > --
>> > Kelly Beard
>> >
>>
>>
>>
>> --
>> Kelly Beard
>>
>
>


-- 
Kelly Beard

Re: Almost in tears (XSD import problems)

Posted by Siva Chandran P <si...@gmail.com>.
Hi,

I think I know the reason behind the errors, you hard coded the schema file
name as "rfidLog.xsd" in your RfidLogResolver. So when the parser processes
the "rfidLog.xsd" it will see the import for "DFCTypes.xsd" and will
request your RfidLogResolver for source. But as you hard coded the file
name, the entity resolver will again return "rfidLog.xsd". That is the
reason it is saying "Imported schema 'DFCTypes.xsd' has a different target
NameSpace 'http://www.quikq.com/xsd/rfidLog' from what's declared '
http://www.quikq.com/DFCTypes'"

BTW, I've attached the corrected file again .

Thanks & Regards,
Siva Chandran P


On Thu, Jan 10, 2013 at 9:56 PM, Kelly Beard <ke...@gmail.com>wrote:

> BTW, Siva, I didn't see your corrected XSD.  I'm using the gmail interface.
>
>
> On Thu, Jan 10, 2013 at 10:15 AM, Kelly Beard <kenverybigliar@gmail.com
> >wrote:
>
> > I've learned XML/XSD piecemeal.  I feel like I need to start over at the
> > beginning sometimes to fill in all of the knowledge holes.  Anyone have a
> > good resource to do this?
> >
> > In any case, I've attached a file that has two pieces of my code.  I can
> > give you all more if it will help.  I'll look at your suggestions.
>  Thanks
> > for mentioning XML Notepad too.  I'll put that utility through it's
> paces.
> >
> > Thanks again guys!
> >
> >
> > On Thu, Jan 10, 2013 at 8:31 AM, Siva Chandran P <
> > siva.chandran.p@gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I am not sure why you are getting the error at line 7, probably you can
> >> show us the source of entity resolver and how you are configuring the
> >> parser.
> >>
> >> I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
> >> validation.
> >>
> >> Line 78, Column 18: Type 'subNumType' is not declared, or is not a
> simple
> >> type.
> >> Line 78, Column 18: Namespace '' is not available to be referenced in
> >> this schema.
> >>
> >> Looks like you need to use namespace prefix even for the types that are
> >> defined just above. Please find the attached corrected xsd.
> >>
> >> Thanks & Regards,
> >> Siva Chandran P
> >>
> >>
> >> On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <kenverybigliar@gmail.com
> >wrote:
> >>
> >>> Thanks.  I had to put some things back.  Like I said, I'm blaming
> adding
> >>> an entityResolver here because thats the only variable I can find.
> >>>
> >>>
> >>>  On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net>
> wrote:
> >>>
> >>>> Can you put a sample of your XML/Xsd  files online in a zip file
> >>>> somewhere, then I can have a look when. I've got a few mins spare..
> >>>>
> >>>> -b
> >>>>
> >>>>
> >>>>
> >>>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com>
> wrote:
> >>>>
> >>>> > I had a dream to make an XSD that contains my most commonly used XML
> >>>> types
> >>>> > and have them contained in an XSD that I could import into other
> XSDs
> >>>> that
> >>>> > represented by other form types.  The namespace I chose for my types
> >>>> XSD is
> >>>> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
> >>>> >
> >>>> > Here's the thing: I think I'm doing everything correctly.  I have a
> >>>> generic
> >>>> > program that I adapted from one of the Xerces samples.  It just
> reads
> >>>> in an
> >>>> > XML document and spits things out based on the events
> (startDocument,
> >>>> > endElement, et al).  I use it to validate a new XSD and run test XML
> >>>> > documents through it to see that the parser isn't going to have
> >>>> problems.
> >>>> >
> >>>> > This sample program has one thing not in common with how I set up my
> >>>> real
> >>>> > production stuff: an entity resolver set with setEntityResolver().
> >>>>  The
> >>>> > sample validator program flies through an XML validated with an XSD
> >>>> that
> >>>> > does an <xs:import>.  In my production stuff however, I get errors
> >>>> like
> >>>> > these:
> >>>> >
> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
> >>>> element=,
> >>>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
> >>>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
> >>>> > http://www.quikq.com/DFCTypes'
> >>>> >
> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
> >>>> > element=, Schema Representation Constraint: Namespace '
> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >>>> declaration
> >>>> >
> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
> >>>> > element=, Schema Representation Constraint: Namespace '
> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >>>> declaration
> >>>> >
> >>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
> >>>> > element=, Schema Representation Constraint: Namespace '
> >>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
> >>>> declaration
> >>>> >
> >>>> > The first error regarding "line=7" is about the <xs:import>
> statement
> >>>> > itself.  There's nothing wrong with it, I swear!
> >>>> >
> >>>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
> >>>> > schemaLocation="DFCTypes.xsd" />
> >>>> >
> >>>> > That is the namespace I want to use and that is the file that those
> >>>> types
> >>>> > are contained in.  Works fine on my validator program - squat on
> >>>> production
> >>>> > stuff.  Notice the error message says that the namespaces in the
> >>>> target XSD
> >>>> > don't match - bullcrap!
> >>>> >
> >>>> > Is anyone interested in helping me out here?  I'm sure the entity
> >>>> stuff is
> >>>> > the problem.  I don't know why I need an entity resolver.  I can
> post
> >>>> > whatever code you'd like to see.
> >>>> >
> >>>> > Thanks!
> >>>> >
> >>>> > --
> >>>> > Kelly Beard
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Kelly Beard
> >>>
> >>
> >>
> >
> >
> > --
> > Kelly Beard
> >
>
>
>
> --
> Kelly Beard
>

Re: Almost in tears (XSD import problems)

Posted by Kelly Beard <ke...@gmail.com>.
BTW, Siva, I didn't see your corrected XSD.  I'm using the gmail interface.


On Thu, Jan 10, 2013 at 10:15 AM, Kelly Beard <ke...@gmail.com>wrote:

> I've learned XML/XSD piecemeal.  I feel like I need to start over at the
> beginning sometimes to fill in all of the knowledge holes.  Anyone have a
> good resource to do this?
>
> In any case, I've attached a file that has two pieces of my code.  I can
> give you all more if it will help.  I'll look at your suggestions.  Thanks
> for mentioning XML Notepad too.  I'll put that utility through it's paces.
>
> Thanks again guys!
>
>
> On Thu, Jan 10, 2013 at 8:31 AM, Siva Chandran P <
> siva.chandran.p@gmail.com> wrote:
>
>> Hi,
>>
>> I am not sure why you are getting the error at line 7, probably you can
>> show us the source of entity resolver and how you are configuring the
>> parser.
>>
>> I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
>> validation.
>>
>> Line 78, Column 18: Type 'subNumType' is not declared, or is not a simple
>> type.
>> Line 78, Column 18: Namespace '' is not available to be referenced in
>> this schema.
>>
>> Looks like you need to use namespace prefix even for the types that are
>> defined just above. Please find the attached corrected xsd.
>>
>> Thanks & Regards,
>> Siva Chandran P
>>
>>
>> On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <ke...@gmail.com>wrote:
>>
>>> Thanks.  I had to put some things back.  Like I said, I'm blaming adding
>>> an entityResolver here because thats the only variable I can find.
>>>
>>>
>>>  On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net> wrote:
>>>
>>>> Can you put a sample of your XML/Xsd  files online in a zip file
>>>> somewhere, then I can have a look when. I've got a few mins spare..
>>>>
>>>> -b
>>>>
>>>>
>>>>
>>>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com> wrote:
>>>>
>>>> > I had a dream to make an XSD that contains my most commonly used XML
>>>> types
>>>> > and have them contained in an XSD that I could import into other XSDs
>>>> that
>>>> > represented by other form types.  The namespace I chose for my types
>>>> XSD is
>>>> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
>>>> >
>>>> > Here's the thing: I think I'm doing everything correctly.  I have a
>>>> generic
>>>> > program that I adapted from one of the Xerces samples.  It just reads
>>>> in an
>>>> > XML document and spits things out based on the events (startDocument,
>>>> > endElement, et al).  I use it to validate a new XSD and run test XML
>>>> > documents through it to see that the parser isn't going to have
>>>> problems.
>>>> >
>>>> > This sample program has one thing not in common with how I set up my
>>>> real
>>>> > production stuff: an entity resolver set with setEntityResolver().
>>>>  The
>>>> > sample validator program flies through an XML validated with an XSD
>>>> that
>>>> > does an <xs:import>.  In my production stuff however, I get errors
>>>> like
>>>> > these:
>>>> >
>>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
>>>> element=,
>>>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
>>>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
>>>> > http://www.quikq.com/DFCTypes'
>>>> >
>>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
>>>> > element=, Schema Representation Constraint: Namespace '
>>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>>> declaration
>>>> >
>>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
>>>> > element=, Schema Representation Constraint: Namespace '
>>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>>> declaration
>>>> >
>>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
>>>> > element=, Schema Representation Constraint: Namespace '
>>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>>> declaration
>>>> >
>>>> > The first error regarding "line=7" is about the <xs:import> statement
>>>> > itself.  There's nothing wrong with it, I swear!
>>>> >
>>>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
>>>> > schemaLocation="DFCTypes.xsd" />
>>>> >
>>>> > That is the namespace I want to use and that is the file that those
>>>> types
>>>> > are contained in.  Works fine on my validator program - squat on
>>>> production
>>>> > stuff.  Notice the error message says that the namespaces in the
>>>> target XSD
>>>> > don't match - bullcrap!
>>>> >
>>>> > Is anyone interested in helping me out here?  I'm sure the entity
>>>> stuff is
>>>> > the problem.  I don't know why I need an entity resolver.  I can post
>>>> > whatever code you'd like to see.
>>>> >
>>>> > Thanks!
>>>> >
>>>> > --
>>>> > Kelly Beard
>>>>
>>>
>>>
>>>
>>> --
>>> Kelly Beard
>>>
>>
>>
>
>
> --
> Kelly Beard
>



-- 
Kelly Beard

Re: Almost in tears (XSD import problems)

Posted by Kelly Beard <ke...@gmail.com>.
I've learned XML/XSD piecemeal.  I feel like I need to start over at the
beginning sometimes to fill in all of the knowledge holes.  Anyone have a
good resource to do this?

In any case, I've attached a file that has two pieces of my code.  I can
give you all more if it will help.  I'll look at your suggestions.  Thanks
for mentioning XML Notepad too.  I'll put that utility through it's paces.

Thanks again guys!


On Thu, Jan 10, 2013 at 8:31 AM, Siva Chandran P
<si...@gmail.com>wrote:

> Hi,
>
> I am not sure why you are getting the error at line 7, probably you can
> show us the source of entity resolver and how you are configuring the
> parser.
>
> I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
> validation.
>
> Line 78, Column 18: Type 'subNumType' is not declared, or is not a simple
> type.
> Line 78, Column 18: Namespace '' is not available to be referenced in this
> schema.
>
> Looks like you need to use namespace prefix even for the types that are
> defined just above. Please find the attached corrected xsd.
>
> Thanks & Regards,
> Siva Chandran P
>
>
> On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <ke...@gmail.com>wrote:
>
>> Thanks.  I had to put some things back.  Like I said, I'm blaming adding
>> an entityResolver here because thats the only variable I can find.
>>
>>
>>  On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net> wrote:
>>
>>> Can you put a sample of your XML/Xsd  files online in a zip file
>>> somewhere, then I can have a look when. I've got a few mins spare..
>>>
>>> -b
>>>
>>>
>>>
>>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com> wrote:
>>>
>>> > I had a dream to make an XSD that contains my most commonly used XML
>>> types
>>> > and have them contained in an XSD that I could import into other XSDs
>>> that
>>> > represented by other form types.  The namespace I chose for my types
>>> XSD is
>>> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
>>> >
>>> > Here's the thing: I think I'm doing everything correctly.  I have a
>>> generic
>>> > program that I adapted from one of the Xerces samples.  It just reads
>>> in an
>>> > XML document and spits things out based on the events (startDocument,
>>> > endElement, et al).  I use it to validate a new XSD and run test XML
>>> > documents through it to see that the parser isn't going to have
>>> problems.
>>> >
>>> > This sample program has one thing not in common with how I set up my
>>> real
>>> > production stuff: an entity resolver set with setEntityResolver().  The
>>> > sample validator program flies through an XML validated with an XSD
>>> that
>>> > does an <xs:import>.  In my production stuff however, I get errors like
>>> > these:
>>> >
>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
>>> element=,
>>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
>>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
>>> > http://www.quikq.com/DFCTypes'
>>> >
>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
>>> > element=, Schema Representation Constraint: Namespace '
>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>> declaration
>>> >
>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
>>> > element=, Schema Representation Constraint: Namespace '
>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>> declaration
>>> >
>>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
>>> > element=, Schema Representation Constraint: Namespace '
>>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>>> declaration
>>> >
>>> > The first error regarding "line=7" is about the <xs:import> statement
>>> > itself.  There's nothing wrong with it, I swear!
>>> >
>>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
>>> > schemaLocation="DFCTypes.xsd" />
>>> >
>>> > That is the namespace I want to use and that is the file that those
>>> types
>>> > are contained in.  Works fine on my validator program - squat on
>>> production
>>> > stuff.  Notice the error message says that the namespaces in the
>>> target XSD
>>> > don't match - bullcrap!
>>> >
>>> > Is anyone interested in helping me out here?  I'm sure the entity
>>> stuff is
>>> > the problem.  I don't know why I need an entity resolver.  I can post
>>> > whatever code you'd like to see.
>>> >
>>> > Thanks!
>>> >
>>> > --
>>> > Kelly Beard
>>>
>>
>>
>>
>> --
>> Kelly Beard
>>
>
>


-- 
Kelly Beard

Re: Almost in tears (XSD import problems)

Posted by Siva Chandran P <si...@gmail.com>.
Hi,

I am not sure why you are getting the error at line 7, probably you can
show us the source of entity resolver and how you are configuring the
parser.

I see an error with DFCTypes.xsd at line 79 with XML Notepad schema
validation.

Line 78, Column 18: Type 'subNumType' is not declared, or is not a simple
type.
Line 78, Column 18: Namespace '' is not available to be referenced in this
schema.

Looks like you need to use namespace prefix even for the types that are
defined just above. Please find the attached corrected xsd.

Thanks & Regards,
Siva Chandran P


On Wed, Jan 9, 2013 at 2:43 AM, Kelly Beard <ke...@gmail.com>wrote:

> Thanks.  I had to put some things back.  Like I said, I'm blaming adding
> an entityResolver here because thats the only variable I can find.
>
>
> On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net> wrote:
>
>> Can you put a sample of your XML/Xsd  files online in a zip file
>> somewhere, then I can have a look when. I've got a few mins spare..
>>
>> -b
>>
>>
>>
>> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com> wrote:
>>
>> > I had a dream to make an XSD that contains my most commonly used XML
>> types
>> > and have them contained in an XSD that I could import into other XSDs
>> that
>> > represented by other form types.  The namespace I chose for my types
>> XSD is
>> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
>> >
>> > Here's the thing: I think I'm doing everything correctly.  I have a
>> generic
>> > program that I adapted from one of the Xerces samples.  It just reads
>> in an
>> > XML document and spits things out based on the events (startDocument,
>> > endElement, et al).  I use it to validate a new XSD and run test XML
>> > documents through it to see that the parser isn't going to have
>> problems.
>> >
>> > This sample program has one thing not in common with how I set up my
>> real
>> > production stuff: an entity resolver set with setEntityResolver().  The
>> > sample validator program flies through an XML validated with an XSD that
>> > does an <xs:import>.  In my production stuff however, I get errors like
>> > these:
>> >
>> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
>> element=,
>> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
>> > http://www.quikq.com/xsd/rfidLog' from what's declared '
>> > http://www.quikq.com/DFCTypes'
>> >
>> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
>> > element=, Schema Representation Constraint: Namespace '
>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> declaration
>> >
>> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
>> > element=, Schema Representation Constraint: Namespace '
>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> declaration
>> >
>> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
>> > element=, Schema Representation Constraint: Namespace '
>> > http://www.quikq.com/DFCTypes' is referenced without <import>
>> declaration
>> >
>> > The first error regarding "line=7" is about the <xs:import> statement
>> > itself.  There's nothing wrong with it, I swear!
>> >
>> > <xs:import namespace="http://www.quikq.com/DFCTypes"
>> > schemaLocation="DFCTypes.xsd" />
>> >
>> > That is the namespace I want to use and that is the file that those
>> types
>> > are contained in.  Works fine on my validator program - squat on
>> production
>> > stuff.  Notice the error message says that the namespaces in the target
>> XSD
>> > don't match - bullcrap!
>> >
>> > Is anyone interested in helping me out here?  I'm sure the entity stuff
>> is
>> > the problem.  I don't know why I need an entity resolver.  I can post
>> > whatever code you'd like to see.
>> >
>> > Thanks!
>> >
>> > --
>> > Kelly Beard
>>
>
>
>
> --
> Kelly Beard
>

Re: Almost in tears (XSD import problems)

Posted by Kelly Beard <ke...@gmail.com>.
Thanks.  I had to put some things back.  Like I said, I'm blaming adding an
entityResolver here because thats the only variable I can find.


On Tue, Jan 8, 2013 at 2:49 PM, Ben Griffin <be...@redsnapper.net> wrote:

> Can you put a sample of your XML/Xsd  files online in a zip file
> somewhere, then I can have a look when. I've got a few mins spare..
>
> -b
>
>
>
> On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com> wrote:
>
> > I had a dream to make an XSD that contains my most commonly used XML
> types
> > and have them contained in an XSD that I could import into other XSDs
> that
> > represented by other form types.  The namespace I chose for my types XSD
> is
> > DFCTypes.  The other XSD/XML forms would have their own namespaces.
> >
> > Here's the thing: I think I'm doing everything correctly.  I have a
> generic
> > program that I adapted from one of the Xerces samples.  It just reads in
> an
> > XML document and spits things out based on the events (startDocument,
> > endElement, et al).  I use it to validate a new XSD and run test XML
> > documents through it to see that the parser isn't going to have problems.
> >
> > This sample program has one thing not in common with how I set up my real
> > production stuff: an entity resolver set with setEntityResolver().  The
> > sample validator program flies through an XML validated with an XSD that
> > does an <xs:import>.  In my production stuff however, I get errors like
> > these:
> >
> > Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML
> element=,
> > Imported schema 'DFCTypes.xsd' has a different target NameSpace '
> > http://www.quikq.com/xsd/rfidLog' from what's declared '
> > http://www.quikq.com/DFCTypes'
> >
> > Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
> > element=, Schema Representation Constraint: Namespace '
> > http://www.quikq.com/DFCTypes' is referenced without <import>
> declaration
> >
> > Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
> > element=, Schema Representation Constraint: Namespace '
> > http://www.quikq.com/DFCTypes' is referenced without <import>
> declaration
> >
> > Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
> > element=, Schema Representation Constraint: Namespace '
> > http://www.quikq.com/DFCTypes' is referenced without <import>
> declaration
> >
> > The first error regarding "line=7" is about the <xs:import> statement
> > itself.  There's nothing wrong with it, I swear!
> >
> > <xs:import namespace="http://www.quikq.com/DFCTypes"
> > schemaLocation="DFCTypes.xsd" />
> >
> > That is the namespace I want to use and that is the file that those types
> > are contained in.  Works fine on my validator program - squat on
> production
> > stuff.  Notice the error message says that the namespaces in the target
> XSD
> > don't match - bullcrap!
> >
> > Is anyone interested in helping me out here?  I'm sure the entity stuff
> is
> > the problem.  I don't know why I need an entity resolver.  I can post
> > whatever code you'd like to see.
> >
> > Thanks!
> >
> > --
> > Kelly Beard
>



-- 
Kelly Beard

Re: Almost in tears (XSD import problems)

Posted by Ben Griffin <be...@redsnapper.net>.
Can you put a sample of your XML/Xsd  files online in a zip file somewhere, then I can have a look when. I've got a few mins spare..

-b



On 8 Jan 2013, at 20:31, Kelly Beard <ke...@gmail.com> wrote:

> I had a dream to make an XSD that contains my most commonly used XML types
> and have them contained in an XSD that I could import into other XSDs that
> represented by other form types.  The namespace I chose for my types XSD is
> DFCTypes.  The other XSD/XML forms would have their own namespaces.
> 
> Here's the thing: I think I'm doing everything correctly.  I have a generic
> program that I adapted from one of the Xerces samples.  It just reads in an
> XML document and spits things out based on the events (startDocument,
> endElement, et al).  I use it to validate a new XSD and run test XML
> documents through it to see that the parser isn't going to have problems.
> 
> This sample program has one thing not in common with how I set up my real
> production stuff: an entity resolver set with setEntityResolver().  The
> sample validator program flies through an XML validated with an XSD that
> does an <xs:import>.  In my production stuff however, I get errors like
> these:
> 
> Error at file "/home/dfcuser/rfidLog.xsd", line=7, column=36, XML element=,
> Imported schema 'DFCTypes.xsd' has a different target NameSpace '
> http://www.quikq.com/xsd/rfidLog' from what's declared '
> http://www.quikq.com/DFCTypes'
> 
> Error at file "/home/dfcuser/rfidLog.xsd", line=18, column=95, XML
> element=, Schema Representation Constraint: Namespace '
> http://www.quikq.com/DFCTypes' is referenced without <import> declaration
> 
> Error at file "/home/dfcuser/rfidLog.xsd", line=20, column=97, XML
> element=, Schema Representation Constraint: Namespace '
> http://www.quikq.com/DFCTypes' is referenced without <import> declaration
> 
> Error at file "/home/dfcuser/rfidLog.xsd", line=22, column=97, XML
> element=, Schema Representation Constraint: Namespace '
> http://www.quikq.com/DFCTypes' is referenced without <import> declaration
> 
> The first error regarding "line=7" is about the <xs:import> statement
> itself.  There's nothing wrong with it, I swear!
> 
> <xs:import namespace="http://www.quikq.com/DFCTypes"
> schemaLocation="DFCTypes.xsd" />
> 
> That is the namespace I want to use and that is the file that those types
> are contained in.  Works fine on my validator program - squat on production
> stuff.  Notice the error message says that the namespaces in the target XSD
> don't match - bullcrap!
> 
> Is anyone interested in helping me out here?  I'm sure the entity stuff is
> the problem.  I don't know why I need an entity resolver.  I can post
> whatever code you'd like to see.
> 
> Thanks!
> 
> -- 
> Kelly Beard