제발 도와주세요.SAXParseException - "szlig"엔티티가 참조되었지만 선언되지 않았습니다. XML 유효성 검사 오류가 있습니까?
나는 유효성을 검사하는 XML 문자열이 있습니다. 때로는 문서가 유효성 검사를 통과하지 못합니다. 단어 "Weiß"가 있기 때문입니다. 이 오류 및 기타 유사한 오류를 수정하는 방법은 무엇입니까? 나는 그 편지에 맹세 한 것을 이해합니다 "ß". 그러나 이상한 행동, 최초의 오류 던진,하지만 두 번째 시간, 같은 라인은 이미 유효합니다. 저는 xerces 라이브러리를 사용합니다.
org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 17; The entity "szlig" was referenced, but not declare
검증
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;
}
감사합니다.
가능한 복제본 [http://stackoverflow.com/questions/15858914/entity-was-referenced-but-not-declared](http://stackoverflow.com/questions/15858914/entity-was-referenced- but-not-declared) –
나는 생각하지 않는다. 내 문제는 해결되지 않습니다. – JDev