@@ -141,7 +141,17 @@ private void _testLinefeeds(final AsyncXMLStreamReader<?> sr, final AsyncReaderW
141
141
142
142
private void _testTextWithEntities (final int chunkSize , final boolean checkValues , final String SPC ) throws Exception
143
143
{
144
- final String XML = SPC + "<root>a<b\r MOT</root>" ;
144
+ _testTextWithEntities (chunkSize , checkValues , SPC , "<" , "<" );
145
+ _testTextWithEntities (chunkSize , checkValues , SPC , ">" , ">" );
146
+ _testTextWithEntities (chunkSize , checkValues , SPC , "&apos" , "'" );
147
+ // for [aalto-xml#78]
148
+ _testTextWithEntities (chunkSize , checkValues , SPC , """ , "\" " );
149
+ }
150
+
151
+ private void _testTextWithEntities (final int chunkSize , final boolean checkValues , final String SPC ,
152
+ final String entity , final String entityExpanded ) throws Exception
153
+ {
154
+ final String XML = SPC + "<root>a" +entity +";b\r MOT</root>" ;
145
155
146
156
final AsyncXMLInputFactory f = new InputFactoryImpl ();
147
157
@@ -150,7 +160,7 @@ private void _testTextWithEntities(final int chunkSize, final boolean checkValue
150
160
try {
151
161
sr_array = f .createAsyncForByteArray ();
152
162
final AsyncReaderWrapperForByteArray reader_array = new AsyncReaderWrapperForByteArray (sr_array , chunkSize , XML );
153
- _testTextWithEntities (sr_array , reader_array , checkValues );
163
+ _testTextWithEntities (sr_array , reader_array , checkValues , entityExpanded );
154
164
} finally {
155
165
if (sr_array != null ) {
156
166
sr_array .close ();
@@ -162,15 +172,17 @@ private void _testTextWithEntities(final int chunkSize, final boolean checkValue
162
172
try {
163
173
sr_buffer = f .createAsyncForByteBuffer ();
164
174
final AsyncReaderWrapperForByteBuffer reader_buffer = new AsyncReaderWrapperForByteBuffer (sr_buffer , chunkSize , XML );
165
- _testTextWithEntities (sr_buffer , reader_buffer , checkValues );
175
+ _testTextWithEntities (sr_buffer , reader_buffer , checkValues , entityExpanded );
166
176
} finally {
167
177
if (sr_buffer != null ) {
168
178
sr_buffer .close ();
169
179
}
170
180
}
171
181
}
172
182
173
- private void _testTextWithEntities (final AsyncXMLStreamReader <?> sr , final AsyncReaderWrapper reader , final boolean checkValues ) throws Exception
183
+ private void _testTextWithEntities (final AsyncXMLStreamReader <?> sr , final AsyncReaderWrapper reader ,
184
+ final boolean checkValues ,
185
+ final String entityExpanded ) throws Exception
174
186
{
175
187
// should start with START_DOCUMENT, but for now skip
176
188
int t = verifyStart (reader );
@@ -182,7 +194,7 @@ private void _testTextWithEntities(final AsyncXMLStreamReader<?> sr, final Async
182
194
assertTokenType (CHARACTERS , reader .nextToken ());
183
195
if (checkValues ) {
184
196
String str = collectAsyncText (reader , CHARACTERS ); // moves to end-element
185
- assertEquals ("a< b\n MOT" , str );
197
+ assertEquals ("a" + entityExpanded + " b\n MOT" , str );
186
198
} else {
187
199
reader .nextToken ();
188
200
}
0 commit comments