This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes valiating xml using multiple schemas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "valiating xml using multiple schemas" Watch "valiating xml using multiple schemas" New topic
Author

valiating xml using multiple schemas

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Hi,
I am trying to parse large XML files.It has to be validated using multiple XSDs.i am using java valiadtor API.the code looks like this-

All XSDs have same namespace.The main XSD uses others using Include tag.Do you need to mention every XSD passing as an array ? or validator API will take care of this? i tried using above code but when run, i get an error as "Cannot find the declaration of element 'endOfTradePeriodNotification'." which is an root element of input XML.

MH
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187



Is 'xsdFile' a String object or a File object?


Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
Its a file object.I am able to validate and parse simple/complex files too.But problem is occuring only for some types of different XMLs.Main Schema is lke this-

As you can see, Gloop which is root element refers to NY. Input XML contains Gloop as root element.Also program is able to find A.xsd and B.xsd but i m getting an error "No declaration for element Gloop found"
Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1874
ok. Problem was not in code.XML file needs to be transformed using XSLT before processing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: valiating xml using multiple schemas
 
Similar Threads
XML - XSD - Java
pom.xml is not valid because cvc-elt.1: Cannot find the declaration of element 'project'.
XSD validation in XML
multiple validation errors in xml for given xsd with java
Problem validating XML against XSD using JDK1.4