Skip to content

'Element <root> has no attribute "verbose"' not thrown from RepairingNsStreamWriter when validating against a DTD schema #190

Open
@ppalaga

Description

@ppalaga

The same scenario is passing for ValidatingStreamReader in the following test:

public void testInvalidAttributeValue() throws Exception
{
final String DOC = "<root note='note' verbose='yes'/>\n";
final String INPUT_DTD =
"<!ELEMENT root ANY>\n"
+"<!ATTLIST root note CDATA #IMPLIED>\n"
;
XMLInputFactory f = getInputFactory();
setCoalescing(f, true);
XMLValidationSchemaFactory schemaFactory =
XMLValidationSchemaFactory.newInstance(XMLValidationSchema.SCHEMA_ID_DTD);
XMLValidationSchema schema = schemaFactory.createSchema(new StringReader(INPUT_DTD));
XMLStreamReader2 sr = (XMLStreamReader2)f.createXMLStreamReader(
new StringReader(DOC));
final List<XMLValidationProblem> probs = new ArrayList<XMLValidationProblem>();
sr.validateAgainst(schema);
sr.setValidationProblemHandler(new ValidationProblemHandler() {
@Override
public void reportProblem(XMLValidationProblem problem)
throws XMLValidationException {
probs.add(problem);
}
});
assertTokenType(START_ELEMENT, sr.next());
assertEquals("root", sr.getLocalName());
final String verboseValue = sr.getAttributeValue(null, "verbose");
assertEquals("yes", verboseValue);
}

When the test is adapted for SimpleNsStreamWriter it still works.

But when the test is adapted for RepairingNsStreamWriter it does not work anymore.

The PR with a reproducer follows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions