Package com.github.oowekyala.ooxml.messages
Simple API to produce nice error messages when reading an XML file.
Use XmlErrorUtils::parse to get an instance of an XmlPositioner.
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.
-
Interface Summary Interface Description NiceXmlMessageFormatter Formats aNiceXmlMessageSpecto make the full message of anXmlException.XmlMessageHandler Handles XML messages, for example forwarding them to a print stream.XmlMessageReporter<M> Reports errors in an XML document.XmlPositioner Associates XML nodes with a position. -
Class Summary Class Description AccumulatingMessageHandler Accumulates messages and does not display them until the reporter is closed.Annots ContextLines Helper object that contains the lines around a specificXmlPosition.ErrorCleaner FullFilePositioner Scanner with known document context.InternalUtil MessageUtil NewOffsetScanner Lazy offset scanner that only scans required nodes.NiceXmlMessageSpec OoxmlFacade Main entry point of the API.PartialFilePositioner PositionedXmlDoc A simple pair of a parsedDocumentand anXmlPositionerthat can position its nodes.PrintStreamMessageHandler ImplementsXmlMessageHandlerwith a pair ofPrintStreams.SpyInputSource SpyInputSource.TeeReader TextDoc XmlMessageReporterBase<M> Base implementation ofXmlMessageReporter.XmlPosition Represents the location of an XML node in a file. -
Enum Summary Enum Description TerminalColor ANSI escape sequences for colors, to style text in terminal environments.XmlSeverity Severity of a message. -
Exception Summary Exception Description XmlException Generic XML exception wrapper. -
Annotation Types Summary Annotation Type Description Annots.Nullable Annots.OneBased Annots.ZeroBased