Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SAXParseException: "s4s-elt-character: Non-whitespace characters are not allowed in schema elements"

Tags:

xml

xsd

sax

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?

like image 971
Antonio Giovanni Schiavone Avatar asked Jan 02 '13 17:01

Antonio Giovanni Schiavone


2 Answers

It looks to me as if the parser is for some reason trying to process your instance document as a schema file.

like image 155
Michael Kay Avatar answered Sep 19 '22 20:09

Michael Kay


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";
like image 33
user5715191 Avatar answered Sep 18 '22 20:09

user5715191