< prev index next >

test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.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 dom.ls;
  25 
  26 import javax.xml.parsers.DocumentBuilderFactory;
  27 import javax.xml.parsers.ParserConfigurationException;
  28 
  29 import org.testng.Assert;

  30 import org.testng.annotations.Test;
  31 import org.w3c.dom.DOMConfiguration;
  32 import org.w3c.dom.DOMError;
  33 import org.w3c.dom.DOMErrorHandler;
  34 import org.w3c.dom.DOMException;
  35 import org.w3c.dom.DOMImplementation;
  36 import org.w3c.dom.ls.DOMImplementationLS;
  37 import org.w3c.dom.ls.LSInput;
  38 import org.w3c.dom.ls.LSParser;
  39 import org.w3c.dom.ls.LSResourceResolver;
  40 
  41 /*
  42  * @summary Test LSParser's DOMConfiguration for supported properties.
  43  */

  44 public class LSParserTest {
  45 
  46     @Test
  47     public void testDOMConfiguration() {
  48 
  49         final DOMErrorHandler handler = new DOMErrorHandler() {
  50             public boolean handleError(final DOMError error) {
  51                 return false;
  52             }
  53         };
  54 
  55         final LSResourceResolver resolver = new LSResourceResolver() {
  56             public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, final String systemId, final String baseURI) {
  57                 return null;
  58             }
  59         };
  60 
  61         final Object[][] values = {
  62                 // parameter, value
  63                 { "canonical-form", Boolean.FALSE }, { "cdata-sections", Boolean.FALSE }, { "cdata-sections", Boolean.TRUE },


   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 dom.ls;
  25 
  26 import javax.xml.parsers.DocumentBuilderFactory;
  27 import javax.xml.parsers.ParserConfigurationException;
  28 
  29 import org.testng.Assert;
  30 import org.testng.annotations.Listeners;
  31 import org.testng.annotations.Test;
  32 import org.w3c.dom.DOMConfiguration;
  33 import org.w3c.dom.DOMError;
  34 import org.w3c.dom.DOMErrorHandler;
  35 import org.w3c.dom.DOMException;
  36 import org.w3c.dom.DOMImplementation;
  37 import org.w3c.dom.ls.DOMImplementationLS;
  38 import org.w3c.dom.ls.LSInput;
  39 import org.w3c.dom.ls.LSParser;
  40 import org.w3c.dom.ls.LSResourceResolver;
  41 
  42 /*
  43  * @summary Test LSParser's DOMConfiguration for supported properties.
  44  */
  45 @Listeners({jaxp.library.BasePolicy.class})
  46 public class LSParserTest {
  47 
  48     @Test
  49     public void testDOMConfiguration() {
  50 
  51         final DOMErrorHandler handler = new DOMErrorHandler() {
  52             public boolean handleError(final DOMError error) {
  53                 return false;
  54             }
  55         };
  56 
  57         final LSResourceResolver resolver = new LSResourceResolver() {
  58             public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, final String systemId, final String baseURI) {
  59                 return null;
  60             }
  61         };
  62 
  63         final Object[][] values = {
  64                 // parameter, value
  65                 { "canonical-form", Boolean.FALSE }, { "cdata-sections", Boolean.FALSE }, { "cdata-sections", Boolean.TRUE },


< prev index next >