Package com.github.oowekyala.ooxml.messages
package com.github.oowekyala.ooxml.messages
Simple API to produce nice error messages when reading an XML file.
Use
to get an instance of an invalid reference
XmlErrorUtils::parseXmlPositioner.
This object is used to associate Nodes with their
location, and create message entries (under the form of an XmlException)
featuring context information.
For example, if an XML parse exception occurs, instead of
javax.xml.transform.TransformerException: The entity "amb" was referenced, but not declared.
the exception has the following message:
XML parsing error (in /some/file.xml)
1| <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2| <list>
3| <list foo="&amb;"/>
^ The entity "amb" was referenced, but not declared.
4| </list>
or
Error at /some/file.xml:3:21 - The entity "amb" was referenced, but not declared.
if you use eg NiceXmlMessageFormatter.SINGLE_LINE.
This API is also useful to validate an XML file after
it's parsed, and emit targeted error messages that come with
the same kind of file help. See XmlMessageReporter.
XmlPositioner is meant
as a low-level utility, to build helpers such as XmlMessageReporter.
-
ClassDescriptionAccumulates messages and does not display them until the reporter is closed.Helper object that contains the lines around a specific
XmlPosition.Scanner with known document context.Lazy offset scanner that only scans required nodes.Formats aNiceXmlMessageSpecto make the full message of anXmlException.Main entry point of the API.A simple pair of a parsedDocumentand anXmlPositionerthat can position its nodes.ImplementsXmlMessageHandlerwith a pair ofPrintStreams.ANSI escape sequences for colors, to style text in terminal environments.Generic XML exception wrapper.Handles XML messages, for example forwarding them to a print stream.Reports errors in an XML document.Base implementation ofXmlMessageReporter.Represents the location of an XML node in a file.Associates XML nodes with a position.Severity of a message.