< prev index next >

test/javax/xml/jaxp/unittest/parsers/Bug6760982.java

Print this page


   1 /*
   2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 parsers;
  25 
  26 import java.io.File;
  27 import java.io.FileReader;
  28 import java.io.Reader;
  29 
  30 import javax.xml.parsers.DocumentBuilder;
  31 import javax.xml.parsers.DocumentBuilderFactory;
  32 
  33 import org.testng.Assert;

  34 import org.testng.annotations.Test;
  35 import org.w3c.dom.Document;
  36 import org.w3c.dom.NamedNodeMap;
  37 import org.w3c.dom.Node;
  38 import org.w3c.dom.NodeList;
  39 import org.xml.sax.InputSource;
  40 
  41 /*
  42  * @bug 6518733
  43  * @summary Test SAX parser handles several attributes with containing "&gt;".
  44  */

  45 public class Bug6760982 {
  46 
  47     @Test
  48     public void test() {
  49         try {
  50             Document xmlDoc = _Parse(new File(getClass().getResource("bug6760982.xml").getFile()));
  51             Node node = xmlDoc.getDocumentElement();
  52 
  53             _ProcessNode(node, 0);
  54             _Flush();
  55         } catch (Exception e) {
  56             _ErrPrintln("Exception: " + e.toString());
  57             Assert.fail("Exception: " + e.getMessage());
  58         }
  59     }
  60 
  61     private static void _Flush() {
  62         System.out.flush();
  63         System.err.flush();
  64     }


   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 parsers;
  25 
  26 import java.io.File;
  27 import java.io.FileReader;
  28 import java.io.Reader;
  29 
  30 import javax.xml.parsers.DocumentBuilder;
  31 import javax.xml.parsers.DocumentBuilderFactory;
  32 
  33 import org.testng.Assert;
  34 import org.testng.annotations.Listeners;
  35 import org.testng.annotations.Test;
  36 import org.w3c.dom.Document;
  37 import org.w3c.dom.NamedNodeMap;
  38 import org.w3c.dom.Node;
  39 import org.w3c.dom.NodeList;
  40 import org.xml.sax.InputSource;
  41 
  42 /*
  43  * @bug 6518733
  44  * @summary Test SAX parser handles several attributes with containing "&gt;".
  45  */
  46 @Listeners({jaxp.library.FilePolicy.class})
  47 public class Bug6760982 {
  48 
  49     @Test
  50     public void test() {
  51         try {
  52             Document xmlDoc = _Parse(new File(getClass().getResource("bug6760982.xml").getFile()));
  53             Node node = xmlDoc.getDocumentElement();
  54 
  55             _ProcessNode(node, 0);
  56             _Flush();
  57         } catch (Exception e) {
  58             _ErrPrintln("Exception: " + e.toString());
  59             Assert.fail("Exception: " + e.getMessage());
  60         }
  61     }
  62 
  63     private static void _Flush() {
  64         System.out.flush();
  65         System.err.flush();
  66     }


< prev index next >