Safe usage of SchemaDVFactory ?
Stian Soiland-Reyes <[email protected]> Thu, 12 Feb 2015 23:08:08 +0000
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <CAMBJEmW1ZhfMc3C4xqF5PiHPo+1NRxNGMj2BNfdK8VaNUf5hDw@mail.gmail.com> |
Hi, Apache Jena uses a feature of Xerces 2 for validating strings that claim to be of XSD schema types, by using the org.apache.xerces.impl.dv.SchemaDVFactory and friends. See for example: https://github.com/stain/jena/blob/JENA-878-explicit-impl-imports/jena-core/src/main/java/com/hp/hpl/jena/datatypes/xsd/XSDDatatype.java#L286 I believe this is very useful outside XML validation, as XSD datatypes are also used in non-XML formats for RDF, like Turtle and JSON-LD. The Xerces2-j javadocs however, warn: https://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/impl/dv/SchemaDVFactory.html > INTERNAL: > Usage of this class is not supported. It may be altered or removed at any time. and of course it is under the .impl package, which made OSGi throw warnings (and me raising the bug https://issues.apache.org/jira/browse/JENA-878 ) Is there a non-impl way in Xerces2-j to do this datatype validation without having to construct a temporary XML document and temporary schema? Should we really be worried about the org.apache.xerces.impl.dv package changing? It seems quite stable and good.. :) Would it be possible to suggest it being "upgraded" to non-impl (which ironically WOULD break existing calls :-/ ) or at least not to have that warning in the doc..? -- Stian Soiland-Reyes Apache Taverna (incubating) http://orcid.org/0000-0001-9842-9718