java - SAXParseException - The entity "szlig" was referenced, but not declare. Error by XML validation? -
please helm me.
i have xml string validating. , sometimes, document not pass validation. because there word "weiß". how fix , other similar errors? understand swears on letter "ß". strange behavior, first time error thrown, second time, same line valid. use xerces library.
org.xml.sax.saxparseexception; linenumber: 19; columnnumber: 17; entity "szlig" referenced, not declare
validation
schemafactory factory = new xmlschemafactory(); try { inputstream stream = thread.currentthread().getcontextclassloader().getresourceasstream(wtconstants.xsd_validator); if (xmlstring.startswith("\ufeff")) { xmlstring = xmlstring.substring(1);// remove bom } schema schema = factory.newschema(new streamsource(stream)); validator validator = schema.newvalidator(); validator.validate(new streamsource(new stringreader(xmlstring))); } catch (saxexception | ioexception e) { logger.error("validation error: ", e); isxmlvalid = false; }
thanks.
try add below code or replace ß character ß
in xml. should work you.
<!doctype definition [ <!entity szlig "ß"> ]>
general solution
you can use doctype declaration refers mathml dtd or local copy of same :
<!doctype math public "-//w3c//dtd mathml 3.0//en" "http://www.w3.org/math/dtd/mathml3/mathml3.dtd">
this dtd have entity references.
Comments
Post a Comment