use of org.xml.sax.helpers.LocatorImpl in project robovm by robovm.
the class HandlerBaseTest method testFatalError.
public void testFatalError() {
// Ordinary case
try {
h.fatalError(new SAXParseException("Foo", new LocatorImpl()));
fail("SAXException expected");
} catch (SAXException e) {
// Expected
}
// No exception
try {
h.fatalError(null);
fail("NullPointerException expected");
} catch (SAXException e) {
fail("NullPointerException expected");
} catch (NullPointerException e) {
// Expected
}
}
use of org.xml.sax.helpers.LocatorImpl in project robovm by robovm.
the class LocatorImplTest method testSetPublicIdGetPublicId.
public void testSetPublicIdGetPublicId() {
LocatorImpl l = new LocatorImpl();
l.setPublicId(PUB);
assertEquals(PUB, l.getPublicId());
l.setPublicId(null);
assertEquals(null, l.getPublicId());
}
use of org.xml.sax.helpers.LocatorImpl in project OpenAM by OpenRock.
the class MarshallerImpl method write.
private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
try {
if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
// if we need to add xsi:schemaLocation or its brother,
// throw in the component to do that.
writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
}
SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
// set a DocumentLocator that doesn't provide any information
writer.setDocumentLocator(new LocatorImpl());
writer.startDocument();
serializer.childAsBody(obj, null);
writer.endDocument();
// extra check
serializer.reconcileID();
} catch (SAXException e) {
throw new MarshalException(e);
}
}
Aggregations