org.codehaus.stax2.LocationInfo Java Examples

The following examples show how to use org.codehaus.stax2.LocationInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestExtLocationInfo91.java    From woodstox with Apache License 2.0 5 votes vote down vote up
private void assertOffset(XMLStreamReader2 sr, int startOffset, int endOffset, String systemId)
    throws XMLStreamException
{
    LocationInfo li = sr.getLocationInfo();
    Location startLoc = li.getStartLocation();
    assertEquals("Incorrect starting systemID for event " + tokenTypeDesc(sr.getEventType()), systemId, startLoc.getSystemId());
    Location endLoc = li.getEndLocation();
    assertEquals("Incorrect ending systemID for event " + tokenTypeDesc(sr.getEventType()), systemId, endLoc.getSystemId());
    assertOffset(sr, startOffset, endOffset);
}
 
Example #2
Source File: TestExtLocationInfo91.java    From woodstox with Apache License 2.0 5 votes vote down vote up
private void assertOffset(XMLStreamReader2 sr, int startOffset, int endOffset)
    throws XMLStreamException
{
    LocationInfo li = sr.getLocationInfo();
    Location startLoc = li.getStartLocation();
    assertEquals("Incorrect starting offset for event "+tokenTypeDesc(sr.getEventType()), startOffset, startLoc.getCharacterOffset());
    Location endLoc = li.getEndLocation();
    assertEquals("Incorrect ending offset for event "+tokenTypeDesc(sr.getEventType()), endOffset, endLoc.getCharacterOffset());
}