The JAXP specification (and any surrounding documentation) should be able to provide you with samples.
Werner > -----Ursprüngliche Nachricht----- > Von: Saladin Sharif [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 16. März 2007 00:17 > An: [email protected] > Betreff: Re: AW: AW: [castor-user] How to do XSD validation when the code > was not generated by the Castor code generator > > > > 1) Instantiate/configure a SAX parser (specify the > > external-schema-location feature) > > Stephen, > > I was not able to find the external-schema-location > feature. It is not listed with Xerces: > > http://xerces.apache.org/xerces2-j/features.html > > > Could you provide me with a code example on how to set > the external-schema-location feature. > Thanks. > > > --- Stephen Bash <[EMAIL PROTECTED]> wrote: > > > Werner and Saladin- > > > > Sorry to jump in at the end here, but there might be > > an easy way > > around this issue. If all you need is a custom > > configured parser you > > can instantiate your own parser and have Castor use > > it: > > > > 1) Instantiate/configure a SAX parser (specify the > > external-schema-location feature) > > 2) Instantiate/configure an Unmarshaller instance > > 3) Call createHandler() on the Unmarshaller object > > to get an > > UnmarshalHandler which implements ContentHandler and > > ErrorHandler > > 4) Set the parser's content handler to the > > UnmarshalHandler object > > 5) Set the parser's error handler to the > > UnmarshalHandler object > > 6) Parse the document > > 7) Call getObject on the UnmarshalHandler to > > retrieve the root object > > > > Feel free to ignore me if I've completely missed the > > mark, but I hope > > that helps. > > > > Stephen > > > > > > On 3/14/07, Werner Guttmann > > <[EMAIL PROTECTED]> wrote: > > > Okay, I don't think that what you want to achieve > > is possible without a small code change to the > > Unmarshaller. I just had a look at the JAXP API, and > > it looks like I have to provide you with an option > > to specify the > > > > > > > > > http://apache.org/xml/properties/schema/external-schemaLocation" > > > > > > feature of the JAXP Parser instance used > > internally by Castor. If this is an option for you, > > please create a new Jira issue at > > > > > > http://jira.codehaus.org/browse/CASTOR > > > > > > and attach the relevant fragments of this email > > conversation. > > > > > > Werner > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: S. Sharif [mailto:[EMAIL PROTECTED] > > > > Gesendet: Dienstag, 13. März 2007 21:00 > > > > An: [email protected] > > > > Betreff: Re: AW: AW: [castor-user] How to do XSD > > validation when the code > > > > was not generated by the Castor code generator > > > > > > > > > > > > Yes it has a namespace declaration. The > > following is > > > > an example of how the input xml looks like: > > > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > > > <Document > > > > > > xmlns="http://www.nproj.com/japps/AcceptRunRequest"> > > > > <CRITERIAINPUT_LIST> > > > > <CRITERIAINPUT> > > > > <CRITERIAID>1</CRITERIAID> > > > > </CRITERIAINPUT> > > > > </CRITERIAINPUT_LIST> > > > > > > > > [ ... remaining xml was omitted for brevity ...] > > > > > > > > </Document> > > > > > > > > > > > > In my project each Java service has one XSD > > schema > > > > file for the input xml that it is expecting. So > > the > > > > above is an example for one input xml for one > > > > particular service. The input xml for the other > > Java > > > > services have a very similar structure with the > > > > namespace decalred in the root tag as in the > > example > > > > above. > > > > -Saladin > > > > > > > ********************************************************** > * Saladin Sharif > * e-mail: [EMAIL PROTECTED] > * Visit homepage @ http://gaia.ecs.csus.edu/~sharifs > ********************************************************** > > > > __________________________________________________________________________ > __________ > Be a PS3 game guru. > Get your game face on with the latest PS3 news and previews at Yahoo! > Games. > http://videogames.yahoo.com/platform?platform=120121 > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

