File tree 2 files changed +25
-6
lines changed
main/java/org/codehaus/plexus/util/xml/pull
test/java/org/codehaus/plexus/util/xml/pull
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -3051,12 +3051,6 @@ else if ( ch == '>' )
3051
3051
throw new XmlPullParserException ( "processing instruction PITarget name not found" , this ,
3052
3052
null );
3053
3053
}
3054
- else
3055
- {
3056
- // seenPITarget && !seenQ
3057
- throw new XmlPullParserException ( "processing instruction started on line " + curLine
3058
- + " and column " + curColumn + " was not closed" , this , null );
3059
- }
3060
3054
}
3061
3055
else
3062
3056
{
Original file line number Diff line number Diff line change @@ -301,6 +301,31 @@ public void testProcessingInstruction()
301
301
assertEquals ( XmlPullParser .END_TAG , parser .nextToken () );
302
302
}
303
303
304
+ @ Test
305
+ public void testProcessingInstructionsContainingXml ()
306
+ throws Exception
307
+ {
308
+ StringBuffer sb = new StringBuffer ();
309
+
310
+ sb .append ( "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>" );
311
+ sb .append ( "<project>\n " );
312
+ sb .append ( " <?pi\n " );
313
+ sb .append ( " <tag>\n " );
314
+ sb .append ( " </tag>\n " );
315
+ sb .append ( " ?>\n " );
316
+ sb .append ( "</project>" );
317
+
318
+ MXParser parser = new MXParser ();
319
+ parser .setInput ( new StringReader ( sb .toString () ) );
320
+
321
+ assertEquals ( XmlPullParser .PROCESSING_INSTRUCTION , parser .nextToken () );
322
+ assertEquals ( XmlPullParser .START_TAG , parser .nextToken () );
323
+ assertEquals ( XmlPullParser .TEXT , parser .nextToken () ); // whitespace
324
+ assertEquals ( XmlPullParser .PROCESSING_INSTRUCTION , parser .nextToken () );
325
+ assertEquals ( XmlPullParser .TEXT , parser .nextToken () ); // whitespace
326
+ assertEquals ( XmlPullParser .END_TAG , parser .nextToken () );
327
+ }
328
+
304
329
@ Test
305
330
public void testSubsequentProcessingInstructionShort ()
306
331
throws Exception
You can’t perform that action at this time.
0 commit comments