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.XMLStreamException; 30 import javax.xml.stream.XMLStreamReader; 31 32 import org.testng.Assert; 33 import org.testng.annotations.Test; 34 35 /* 36 * @summary Test double namespaces and nested namespaces. 37 */ 38 public class DoubleXmlnsTest { 39 40 @Test 41 public void testDoubleNS() throws Exception { 42 43 final String INVALID_XML = "<foo xmlns:xmli='http://www.w3.org/XML/1998/namespacei' xmlns:xmli='http://www.w3.org/XML/1998/namespacei' />"; 44 45 try { 46 XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML)); 47 48 while (xsr.hasNext()) { 49 xsr.next(); 50 } 51 52 Assert.fail("Wellformedness error expected: " + INVALID_XML); 53 } catch (XMLStreamException e) { 54 ; // this is expected 55 } 56 } 57 | 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.XMLStreamException; 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 double namespaces and nested namespaces. 38 */ 39 @Listeners({jaxp.library.BasePolicy.class}) 40 public class DoubleXmlnsTest { 41 42 @Test 43 public void testDoubleNS() throws Exception { 44 45 final String INVALID_XML = "<foo xmlns:xmli='http://www.w3.org/XML/1998/namespacei' xmlns:xmli='http://www.w3.org/XML/1998/namespacei' />"; 46 47 try { 48 XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML)); 49 50 while (xsr.hasNext()) { 51 xsr.next(); 52 } 53 54 Assert.fail("Wellformedness error expected: " + INVALID_XML); 55 } catch (XMLStreamException e) { 56 ; // this is expected 57 } 58 } 59 |