13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.StringReader; 27 28 import javax.xml.stream.XMLInputFactory; 29 import javax.xml.stream.XMLStreamConstants; 30 import javax.xml.stream.XMLStreamReader; 31 32 import org.testng.Assert; 33 import org.testng.annotations.Test; 34 35 /* 36 * @summary Test StAX parser can parse xml without declaration. 37 */ 38 public class BugTest { 39 40 @Test 41 public static void test1() throws Exception { 42 XMLInputFactory xif = XMLInputFactory.newInstance(); // new 43 // com.sun.xml.stream.ZephyrParserFactory(); 44 XMLStreamReader r = xif.createXMLStreamReader(new StringReader("<foo/>")); 45 Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType()); 46 } 47 } | 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.StringReader; 27 28 import javax.xml.stream.XMLInputFactory; 29 import javax.xml.stream.XMLStreamConstants; 30 import javax.xml.stream.XMLStreamReader; 31 32 import org.testng.Assert; 33 import org.testng.annotations.Listeners; 34 import org.testng.annotations.Test; 35 36 /* 37 * @summary Test StAX parser can parse xml without declaration. 38 */ 39 @Listeners({jaxp.library.BasePolicy.class}) 40 public class BugTest { 41 42 @Test 43 public static void test1() throws Exception { 44 XMLInputFactory xif = XMLInputFactory.newInstance(); // new 45 // com.sun.xml.stream.ZephyrParserFactory(); 46 XMLStreamReader r = xif.createXMLStreamReader(new StringReader("<foo/>")); 47 Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType()); 48 } 49 } |