List of usage examples for javax.xml.bind ValidationEventLocator getColumnNumber
public int getColumnNumber();
From source file:org.squidy.manager.parser.ModelHandler.java
/** * Parses a given input stream (should contain model and diagram code as xml * structure) and returns it as an object structure. * /*from w w w . j a v a2 s .com*/ * @param inputStream * The input stream should contain model and diagram structure. * @return The parsed XMI document containing model and diagram in object * representation. */ @SuppressWarnings("restriction") public Data load(InputStream inputStream) { try { Unmarshaller unmarshaller = getContext().createUnmarshaller(); unmarshaller.setEventHandler(new ValidationEventHandler() { /* * (non-Javadoc) * * @see * javax.xml.bind.ValidationEventHandler#handleEvent(javax.xml * .bind.ValidationEvent) */ public boolean handleEvent(ValidationEvent e) { // Ignore this as workspace-shape is located in not // referenced squidy-designer module if (e.getMessage().startsWith("unexpected element (uri:\"\", local:\"workspace-shape\")")) { return true; } ValidationEventLocator locator = e.getLocator(); if (LOG.isErrorEnabled()) { LOG.error("Error while reading input stream: \"" + e.getMessage() + "\" [line=" + locator.getLineNumber() + ", column=" + locator.getColumnNumber() + "]" + e.getLinkedException()); } return true; } }); return (Data) unmarshaller.unmarshal(inputStream); } catch (JAXBException e) { if (LOG.isErrorEnabled()) { LOG.error(e.getMessage(), e); } return null; } }
From source file:org.sweble.wikitext.dumpreader.DumpReader.java
protected boolean processEvent(ValidationEvent ve, ValidationEventLocator vel) throws Exception { logger.warn(String.format("%s:%d:%d: %s", dumpUri, vel.getLineNumber(), vel.getColumnNumber(), ve.getMessage()));/*from ww w . j a v a 2 s .co m*/ return true; }