Reputation: 932
I'm developing an Java application who read some data from an xml file. Trying to execute, I get this error:
org.xml.sax.SAXParseException; systemId: file:/c:/myxmlfile.xml; lineNumber: 7; columnNumber: 55; s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'My Name Value'.
My xml file starts with:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<gdl_set xmlns="http://www.mywebsite.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mywebsite.com/myxsddefinition.xsd"
shortname="Shortname">
<name>My Name Value</name>
Can you help me to understand where's the problem?
Upvotes: 5
Views: 16463
Reputation: 463
I was using:
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
and not 1.6 version and in 2.2 version you can specify:
<sources>
<source>src/main/resources/masteraccount/</source>
</sources>
but I forgot to add
<xjcSourceExcludeFilters>
<filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
<patterns>
<pattern>\.xml</pattern>
</patterns>
</filter>
</xjcSourceExcludeFilters>
which disables the use of .xml files. In my case plugin was trying to use .xml file but the correct my schema was in .xsd file.
Upvotes: 0
Reputation: 51
Yes I also got the same issue, then I found the that I was passing the XSD file as an input of XML file.
Like that -
String xsdPath= "122015/1224/sample.xml";
String **xmlPath** = "122015/1224/sample.xsd";
Upvotes: 5
Reputation: 583
I got the same error when I was trying to validate a Transformation file.
The reason I was getting the error was because I was validating it with an XML file instead of an XSD. In my project, they both have the same name. So I mistakenly gave the name of the XML file in place of XSD.
Once I changed that, it was working as expected. So, see if that is the problem in your case if the above solutions did not work.
Upvotes: 1
Reputation: 163262
It looks to me as if the parser is for some reason trying to process your instance document as a schema file.
Upvotes: 4