We help IT Professionals succeed at work.

Validate XML with XSD

jimc5240
jimc5240 asked
on
641 Views
Last Modified: 2012-05-06
Hi,

I'm completely new to XML and I'm trying to validate and XML document with an XSD.  I've used two different tools to try and make this work and both fail with essentially the same error:

"The element declaration was not found for root element query.querySubmission.  "

I've read every thing I could find on this and I'm still baffled by the whole thing.  Here is the document header:

<?xml version="1.0" encoding="UTF-8"?>
<query:querySubmission xmlns:query="http://www.npdb-hipdb.hrsa.gov/Query" xmlns:co="http://www.npdb-hipdb.hrsa.gov/Common" xmlns:ad="http://www.npdb-hipdb.hrsa.gov/Address" xmlns:orgCd="http://www.npdb-hipdb.hrsa.gov/OrganizationCode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.npdb-hipdb.hrsa.gov/Common \\voyager\c$\QRXS\npdb-hipdb-common.xsd">

Can anyone point me in the right direction?  Thanks
Comment
Watch Question

Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
That either means that the schema is not found at location
\\voyager\c$\QRXS\npdb-hipdb-common.xsd
or that the querySubmission element is not declared in that namespace

The target namespace of the schema appears to be
http://www.npdb-hipdb.hrsa.gov/Common

The namespace of the querySubmission is
http://www.npdb-hipdb.hrsa.gov/Query

Since they are different, this means that there is a schema import.
So make sure that inside the schema the imports of other schema modules is pointing to accessible files

Maybe you can send the schema

Author

Commented:
I just tried to attach the files and the web site says that the file extension .xsd is not allowed.  I tried zipping it up but no go.  Can I cut and paste something?

Thanks
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
you can always change the extension to .txt
the server will then accept it
(or send a zip to my email address, found in my profile)

Author

Commented:
Duh.  Here it is
npdb-hipdb-common.txt
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
Hey, I can't verify where the problem is, because you are importing other schema modules, which you did not provide
please check them for further nested imports, I suspect there are more

    <import namespace="http://www.npdb-hipdb.hrsa.gov/OrganizationCode" schemaLocation="npdb-hipdb-organization-type-code.xsd"/>
    <import namespace="http://www.npdb-hipdb.hrsa.gov/Address" schemaLocation="npdb-hipdb-address.xsd"/>
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
so, make sure that at your site, all modules you need are available at the import address
after that validate again

good luck

Geert

Author

Commented:
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
well
before I can tell you more...
I think you are at least missing this one
npdb-hipdb-organization-type-code.xsd
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
If you don't have that one, it explains why the XML was not valid

Author

Commented:
Okay, I think I found the remaining files but still can't get it to work.  Here are the files.
npdb-hipdb-organization-type-cod.txt
npdb-hipdb-organization.txt
Information Architect
CERTIFIED EXPERT
Top Expert 2006
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I know this isn't an aswer but I wanted to give you the points for the effort, thanks
Gertone (Geert Bormans)Information Architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
welcome, it would have pleased me more, if I would have given you more help

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.