Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XML Schema in a jar file?  RSS feed

 
Marc Haberkorn
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to find a way to package an XML schema (or DTD if it's easier) file inside a jar file that goes with my application. Is this possible? If so, does anyone know how to do it?
Thanks!
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you be a little bit more specific, 'cause I guess I miss the point here.
A jar file is just an archive. You can add anything within.
Depending on the IDE you are using, it will do it by itself. I mean, if the xsd is at the same location than your java code, then the jar generated will contain the java .class *and* the xsd.
 
Marc Haberkorn
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry...
The issue is how to extract the XSD once it's in the jar file. Obviously you can package any file within an archive. How do you programatically use an XSD file from within a jar file?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you programatically use an XSD file from within a jar file?

By using one of

It's all in the API...
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Haberkorn:
I need to find a way to package an XML schema (or DTD if it's easier) file inside a jar file that goes with my application. Is this possible? If so, does anyone know how to do it?
Thanks!


Refer to this:
Xerces Samples
Am not sure about the parser that you ( i mean the app server) are using.
Make sure that it is JAXP1.2 complaint to use the sample. Infact we configure weblogic to use xerces parsers.

construct the schemaFile object using the technique specified in the previous post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!