简体   繁体   中英

Java XML: How to force wildcard (xs:any) strict matching?

I have a bunch of external XSDs which I can't change. They use wildcard content models (xs:any ) with processContents="skip" .

Question:
Is there a programmatic way in java/JAXP to force wildcard ( xs:any ) processContents="strict" matching instead (without changing the XSDs)?

Sure. Use Java to modify the schema before using it for validation. You don't have to change the original schema, just the one that you're validating against.

If you're using XSD 1.1 you could create the locally-modified schema using xs:override .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM