Skip to content

Commit 2c6fe7e

Browse files
joehnimichael-o
authored andcommitted
Fix start position of PI and comment for all reported errors (#124)
This closes #124
1 parent 89b8ef5 commit 2c6fe7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -2988,7 +2988,7 @@ private void parseComment()
29882988
posStart = pos;
29892989

29902990
final int curLine = lineNumber;
2991-
final int curColumn = columnNumber;
2991+
final int curColumn = columnNumber - 4;
29922992
try
29932993
{
29942994
final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
@@ -3109,7 +3109,7 @@ private boolean parsePI()
31093109
if ( tokenize )
31103110
posStart = pos;
31113111
final int curLine = lineNumber;
3112-
final int curColumn = columnNumber;
3112+
final int curColumn = columnNumber - 2;
31133113
int piTargetStart = pos;
31143114
int piTargetEnd = -1;
31153115
final boolean normalizeIgnorableWS = tokenize && !roundtripSupported;
@@ -3156,7 +3156,7 @@ else if ( !seenInnerTag )
31563156
{
31573157
// seenPITarget && !seenQ
31583158
throw new XmlPullParserException( "processing instruction started on line " + curLine
3159-
+ " and column " + (curColumn -2) + " was not closed", this, null );
3159+
+ " and column " + curColumn + " was not closed", this, null );
31603160
}
31613161
}
31623162
else if ( ch == '<' )

0 commit comments

Comments
 (0)