java - XSD with import in Gradle resource folder can't be read by SAX -
i have generated xsd validation files schemagen.
there both one-file validation xsd , two-file validation xsd imports.
there no problem include one-file validation xsd file in java application validation gradle resource folder. if try load two-file validation xsd import gradle resource folder shown below, crash following error:
org.xml.sax.saxparseexception; linenumber: 12; columnnumber: 98; src-resolve: name "ns1:stringarray" kann nicht als "type definition"-komponente aufgelöst werden. means in english: name can't resolved type definition component
if two-file validation xsd located in gradle source folder, works properly, there can't error in file except resolving of import location.
my xsd file looks following:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <xs:schema version="1.0" targetnamespace="" xmlns:ns1="http://jaxb.dev.java.net/array" xmlns:tns="" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:import namespace="http://jaxb.dev.java.net/array" schemalocation="schema2.xsd"/> <xs:element name="degrees" type="tns:degreecourse"/> <xs:complextype name="degreecourse"> <xs:sequence> <xs:element name="e" type="ns1:stringarray" minoccurs="0" maxoccurs="unbounded"/> </xs:sequence> </xs:complextype> </xs:schema>
it's loaded by:
schema schema = schemafactory .newschema(getstreamsourceofschema("schema1.xsd")); private streamsource getstreamsourceofschema(string schemaname) { return new streamsource(this.getclass().getresourceasstream( "/" + schemaname)); }
although using src/main/resources before schema location in import statement didn't help. ideas?
Comments
Post a Comment