Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

SaxParseException while validating the xml using xsd file

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When I try to validate my xml input using validator, it throws the following exception:



The same thing used to work earlier, but now with no changes made, it's not working. The same thing works on other server without any issue.

Here is my xml file:

<CFTSContract contractNumber = "TAAAXCA" country="897" company="NEWSYSX" actionCode = 'U'>
</CFTSContract>

And my xsd file is:




And my validator java file is:


I am using WebSphere 9.0 for this web service. Any idea how this can be fixed.
 
Sheriff
Posts: 21920
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Poorna Alle wrote:


That WEB-INF part is the problem. Any resource that's located inside the WEB-INF folder is not accessible directly through HTTP(S).

Since this XSD file is located in another web application, you can't simply use it as a resource. You need to go cross-context. For Tomcat, you could use https://stackoverflow.com/questions/6552231/requestdispatcher-to-url-in-a-different-web-app. You'd need to check out how to do this in WebSphere.
 
Rob Spoor
Sheriff
Posts: 21920
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I misread your code. The XSD appears to be inside your application itself. That means that you can try using ServletContext.getResource. That also returns a URL, but one that does not use HTTP but instead simply looks directly inside your application.
 
Poorna Alle
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rob, Thanks for the reply. In fact, this has been the working code since long, and it still works on other servers. So, we would not want to change the code and instead trying to find the reason why the exception is happening during validation. If we know the reason, we can fix that to make this same code work again.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic