xml Validation error in Eclipse

1,418 views
Skip to first unread message

Maurizio Gennaro Cataldo

unread,
Jul 11, 2011, 8:08:41 AM7/11/11
to xnat_discussion
Hi,

I'm using Eclipse Helios as development environment for XNAT and I've
installed the following plugin:

Eclipse XML Editors and Tools 3.2.3.v201102160550
org.eclipse.wst.xml_ui.feature.feature.group

to handle the xml files.

I've found that validation of the XML file /xnat/projects/xnat/src/
schemas/assessments/display/xnat_a_updrs3Data_display.xml
results in the following 4 errors:

1
Referenced file contains errors (file:/home/administrator/workspace/
xnat/projects/xnat/src/schemas/xdat/display.xsd). For more
information, right click on the message in the Problems View and
select "Show Details..." xnat_a_updrs3Data_display.xml /xnat/projects/
xnat/src/schemas/assessments/display line 1 XML Problem

2
cvc-elt.4.2: Cannot resolve 'SubQueryField' to a type definition for
element 'DisplayField'. xnat_a_updrs3Data_display.xml /xnat/projects/
xnat/src/schemas/assessments/display line 71 XML Problem

3
cvc-elt.4.2: Cannot resolve 'SubQueryField' to a type definition for
element 'DisplayField'. xnat_a_updrs3Data_display.xml /xnat/projects/
xnat/src/schemas/assessments/display line 94 XML Problem

4
cvc-elt.1: Cannot find the declaration of element 'Displays'.
xnat_a_updrs3Data_display.xml /xnat/projects/xnat/src/schemas/
assessments/display line 2 XML Problem


I don't think this is normal and at the same time I cannot figure out
how to resolve the problem without risks for the overall xml data
structure.
The files are the original one I downloaded from the repository.

Any ideas?

Many Thanks
Maurizio Gennaro Cataldo

Herrick, Rick

unread,
Jul 11, 2011, 10:01:21 AM7/11/11
to xnat_di...@googlegroups.com
Maurizio,

I'm running Helios as well and the display.xsd parses fine, as does xnat_a_updrs3Data_display.xml. I suspect something's going wrong with your XML editing plugin. The version number that I have is so far off of yours (mine's 1.1.104.v201103021532) that I suspect they're quite different in some way.

As the error indicates, right-click the message in the Problems View and select Show Details. You can also just open up display.xsd and see what's highlighted in there. I think that if you resolve whatever's going on with understanding display.xsd you'll fix your XML errors as well, since that XML file references the display.xsd directly.

So start with the specific errors you're seeing for display.xsd.

Hi,

Any ideas?

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.


The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Maurizio Gennaro Cataldo

unread,
Jul 12, 2011, 5:25:45 AM7/12/11
to xnat_di...@googlegroups.com
Hi Rick,

I've tried to validate  xnat_a_updrs3Data_display.xml using XML Copy Editor (ubuntu 64bit version) and I've got
the same error I've got when I tried to validate the instance xml file using Eclipse Helios plugin.

Both display.xsd and  xnat_a_updrs3Data_display.xml are Well-Formed, but when I validate
the instance document using XML Copy Editor I've got the following error:
 
Validation stopped at line 2, column 208: schema document '../../xdat/display.xsd' has different target namespace from the one specified in instance document

I'm lost in the xml jungle... any help?

many thanks
Maurizio

2011/7/11 Herrick, Rick <herr...@mir.wustl.edu>

Maurizio Gennaro Cataldo

unread,
Jul 12, 2011, 5:33:38 AM7/12/11
to xnat_di...@googlegroups.com
Hi Rick,

I'm posting the first lines of both the files:

These are original files.

Regards
Maurizio


2011/7/12 Maurizio Gennaro Cataldo <maurizio...@gmail.com>

Herrick, Rick

unread,
Jul 12, 2011, 1:03:15 PM7/12/11
to xnat_di...@googlegroups.com

Give this a try to see if it clears up the error. In xnat_a_updrs3Data_display.xml, replace the whole xsi:noNamespaceSchemaLocation=”…”  attribute in the <Displays> element with this:

 

xsi:schemaLocation="http://nrg.wustl.edu/display ../../xdat/display.xsd"

 

That should associate the target namespace with the schema document for the validated XML document and remove the errors.

 

As it happens, the reason I wasn’t getting that validation error in Eclipse is because I’d turned off the validation for that J

 

We’ll look into the effect of migrating from the noNamespaceSchemaLocation attribute to actually mapping the namespace explicitly.

Herrick, Rick

unread,
Jul 12, 2011, 1:07:01 PM7/12/11
to xnat_di...@googlegroups.com

BTW, I’ve verified that this validates properly in the XML editor, I’ve not had a chance to validate that it works in an actual build and deployment, so caveat emptor!

Maurizio Gennaro Cataldo

unread,
Jul 25, 2011, 5:52:56 AM7/25/11
to xnat_discussion
Rick,

I tried the correction you suggested but the xml file still does not
validate.

A question to the group: is there anyone that have problems in
validating the xml files?

Xnat is strongly based on xml so it is seriously important to be able
to validate them.
If I cannot validate the files I cannot procede.

best regards
Maurizio


On Jul 12, 7:07 pm, "Herrick, Rick" <herri...@mir.wustl.edu> wrote:
> BTW, I've verified that this validates properly in the XML editor, I've not had a chance to validate that it works in an actual build and deployment, so caveat emptor!
>
> From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of Herrick, Rick
> Sent: Tuesday, July 12, 2011 12:03 PM
> To: xnat_di...@googlegroups.com
> Subject: RE: [XNAT Discussion] xml Validation error in Eclipse
>
> Give this a try to see if it clears up the error. In xnat_a_updrs3Data_display.xml, replace the whole xsi:noNamespaceSchemaLocation="..."  attribute in the <Displays> element with this:
>
> xsi:schemaLocation="http://nrg.wustl.edu/display../../xdat/display.xsd<http://nrg.wustl.edu/xdat/display.xsd>"
>
> That should associate the target namespace with the schema document for the validated XML document and remove the errors.
>
> As it happens, the reason I wasn't getting that validation error in Eclipse is because I'd turned off the validation for that :)
>
> We'll look into the effect of migrating from the noNamespaceSchemaLocation attribute to actually mapping the namespace explicitly.
>
> From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of Maurizio Gennaro Cataldo
> Sent: Tuesday, July 12, 2011 4:34 AM
> To: xnat_di...@googlegroups.com
> Subject: Re: [XNAT Discussion] xml Validation error in Eclipse
>
> Hi Rick,
>
> I'm posting the first lines of both the files:
>
>  *   display.xsd
>
>     *
>     *   <?xml version="1.0" encoding="UTF-8"?>
>     *   <!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Tim Olsen (Washington University) -->
>     *   <xs:schema targetNamespace="http://nrg.wustl.edu/display" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:display="http://nrg.wustl.edu/display" elementFormDefault="qualified" attributeFormDefault="unqualified">
>
>  *    xnat_a_updrs3Data_display.xml
>
>     *
>     *   <?xml version="1.0" encoding="UTF-8"?>
>     *   <Displays xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xdat/display.xsd" schema-element="xnat_a:updrs3Data" full-description="UPDRS3" brief-description="UPDRS3">
> These are original files.
>
> Regards
> Maurizio
>
> 2011/7/12 Maurizio Gennaro Cataldo <maurizio.cata...@gmail.com<mailto:maurizio.cata...@gmail.com>>
> Hi Rick,
>
> I've tried to validate  xnat_a_updrs3Data_display.xml using XML Copy Editor (ubuntu 64bit version) and I've got
> the same error I've got when I tried to validate the instance xml file using Eclipse Helios plugin.
>
> Both display.xsd and  xnat_a_updrs3Data_display.xml are Well-Formed, but when I validate
> the instance document using XML Copy Editor I've got the following error:
>
> Validation stopped at line 2, column 208: schema document '../../xdat/display.xsd' has different target namespace from the one specified in instance document
>
> I'm lost in the xml jungle... any help?
>
> many thanks
> Maurizio
> 2011/7/11 Herrick, Rick <herri...@mir.wustl.edu<mailto:herri...@mir.wustl.edu>>
> To post to this group, send email to xnat_di...@googlegroups.com<mailto:xnat_di...@googlegroups.com>.
> To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com<mailto:xnat_discussion%2Bunsub scr...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/xnat_discussion?hl=en.
> The material in this message is private and may contain Protected Healthcare Information (PHI).  If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited.  If you have received this email in error, please immediately notify the sender via telephone or return mail.
>
> --
> You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
> To post to this group, send email to xnat_di...@googlegroups.com<mailto:xnat_di...@googlegroups.com>.
> To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com<mailto:xnat_discussion%2Bunsub scr...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/xnat_discussion?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
> To post to this group, send email to xnat_di...@googlegroups.com<mailto:xnat_di...@googlegroups.com>.
> To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com<mailto:xnat_discussion+unsubsc ri...@googlegroups.com>.
> For more options, visit this group athttp://groups.google.com/group/xnat_discussion?hl=en.
> --
> You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
> To post to this group, send email to xnat_di...@googlegroups.com<mailto:xnat_di...@googlegroups.com>.
> To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com<mailto:xnat_discussion+unsubsc ri...@googlegroups.com>.

Olsen, Tim

unread,
Jul 25, 2011, 10:09:17 AM7/25/11
to xnat_di...@googlegroups.com
When I replace the noNamespaceSchemaLocation with this...

xsi:schemaLocation="http://nrg.wustl.edu/display../../xdat/display.xsd"

The errors in eclipse go away.

Tim

Rick,

best regards
Maurizio

To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.

Herrick, Rick

unread,
Jul 25, 2011, 10:46:10 AM7/25/11
to xnat_di...@googlegroups.com
Maurizio,

Two possible things you can try:

* I noticed I missed one other change on that line. It still works in my Eclipse without this, but for completeness you should add the xmlns="..." attribute. Thus that first line goes from this:

<Displays xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xdat/display.xsd" schema-element="xnat_a:updrs3Data" full-description="UPDRS3" brief-description="UPDRS3">

To this:

<Displays xmlns="http://nrg.wustl.edu/display" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nrg.wustl.edu/display ../../xdat/display.xsd" schema-element="xnat_a:updrs3Data" full-description="UPDRS3" brief-description="UPDRS3">

In the XML editor in IntelliJ, I got a notice that the namespace was never used, which was true. Setting the xmlns attribute sets the default namespace for the document which means that all of the elements within that block are defined from the display.xsd by default. It seemed to work within Eclipse without that though.

* If you're still having validation issues within Eclipse, try clicking on the Project menu and selecting the Clean... command. Either select just your xnat project or let it do your whole workspace. Sometimes Eclipse doesn't catch up with changes properly, especially in XML.

To make sure we're working with the same document, I've attached a modified copy of the file that's working properly for me in Eclipse so you can compare. Small differences in XML files can lead to radically different results!

xnat_a_updrs3Data_display.xml

Maurizio Gennaro Cataldo

unread,
Jul 25, 2011, 12:17:14 PM7/25/11
to xnat_di...@googlegroups.com
Rick, Many thanks!!!

I'll try it tomorrow morning at work. Can you please attach also the display.xsd file just to be sure to be working on the same data.

Regards,
Maurizio

2011/7/25 Herrick, Rick <herr...@mir.wustl.edu>

Herrick, Rick

unread,
Jul 25, 2011, 12:18:47 PM7/25/11
to xnat_di...@googlegroups.com

Done.

 

If you continue to have issues, go ahead and contact me off-list and I’ll follow up with you to get to the bottom of it. And if you don’t continue to have issues, let me know that as well, just so that we know that this can be dealt with!

display.xsd
Reply all
Reply to author
Forward
0 new messages