Hi Eliot, Eliot Kimber <[EMAIL PROTECTED]> wrote on 03/10/2008 03:46:12 PM:
> I need to process schema-based documents with Saxon where the documents > need to have default attribute values that are only in the schema (these > happen to be DITA documents where the processing depends on the values > of the common class= attribute which normally never exists in instances). > > I'm using Xerces as the parser by using these two JVM args: > > -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp. > DocumentBuilderFactoryImpl > -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp. > SAXParserFactoryImpl > > That makes Xerces the parser but does not, by itself, turn on schema > validation. > > I added this arg: > > -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache. > xerces.parsers.StandardParserConfiguration > > But it had no apparent affect. In particular, the default attribute > values were not being passed through to Saxon. All you've done by setting that property is specify a parser configuration which is capable of performing schema validation. You still need to turn the feature on programmatically. > I feel like I should be able to do this completely from the command line > by setting the appropriate JVM parameters but so far I have not been > able to and I'm not sure if it's user error or a missing feature of Xerces. > > My fallback was to create a simple subclass of SaxParserFactoryImpl and > set the schema validation property there, which works (I'm now seeing > the default attribute values). But I was really hoping to avoid having > to maintain a custom class (with all the deployment complexity that > implies) if I can do everything from the command line. > > My expectation was that I would be able to use JVM args to set all the > relevant Xerces parser properties or, failing that, create a > configuration properties file. But I see nothing the Xerces docs that > suggest either approach is supported. > > So my questions are: > > 1. Is there a way to configure Xerces to do schema validation for > JAXP-based parser users from the command line? There isn't and in general there's no way to accomplish that with Xerces other features. > 2. If not, why not? No one asked for it. Also, using system properties to configure the parser may be a convenient solution but it can create more problems [1]. > Thanks, > > Eliot > > -- > Eliot Kimber > Senior Solutions Architect > "Bringing Strategy, Content, and Technology Together" > Main: 610.631.6770 > www.reallysi.com > www.rsuitecms.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Thanks. [1] http://issues.apache.org/jira/browse/XERCESJ-976 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]