Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4963567

DOMConfiguration: some required LSParser properties are not supported

XMLWordPrintable

    • rc
    • generic
    • generic

      Name: erR10175 Date: 12/04/2003


       
        The following property/value pairs of LSParser configuration are required by spec
      but not supported by the implementation of the interface org.w3c.dom.DOMConfiguration
      returned by LSParser.getConfig():

      ('supported-media-types-only', false)
      ('resource-resolver', null)
      ('ignore-unknown-character-denormalizations', true)
      ('disallow-doctype', false)
      ('element-content-whitespace', true)
      ('split-cdata-sections', false)
      ('split-cdata-sections', true)
      ('normalize-characters', false)
      ('namespace-declarations', false)
      ('infoset', true)
      ('check-character-normalization', false)
      ('cdata-sections', false)

      For the description of the LSParser properties see the documentation
      of the method org.w3c.dom.ls.LSParser.getConfig().

      This bug affects new tests in JCK 1.5 (not integrated yet)
         api/org_w3c/dom/DOMConfiguration/index.html#Params[CheckCharNorm002]

      The bug is found in jdk1.5.0/beta/b30.

      To reproduce the bug compile and run the following code as shown
      in the log below:
      ------------------------------ test.java
      import org.w3c.dom.DOMConfiguration;
      import org.w3c.dom.DOMImplementation;
      import org.w3c.dom.DOMException;
      import org.w3c.dom.DOMError;
      import org.w3c.dom.DOMErrorHandler;
      import org.w3c.dom.ls.LSResourceResolver;
      import org.w3c.dom.ls.DOMImplementationLS;
      import org.w3c.dom.ls.LSParser;
      import org.w3c.dom.ls.LSInput;
      import javax.xml.parsers.DocumentBuilderFactory;

      class test {

          static final DOMErrorHandler handler = new DOMErrorHandler() {
              public boolean handleError(DOMError error) {
                  return false;
              }
          };

          static final LSResourceResolver resolver = new LSResourceResolver() {
              public LSInput resolveResource(String type,
                              String namespaceURI,
                              String publicId,
                              String systemId,
                              String baseURI) {
                  return null;
              }
          };

          /**
           * list of all required parameter/value pairs for
           * LSParser configuration
           */
          static final Object [][] values = {
              // parameter, value
              {"canonical-form", Boolean.FALSE},
              {"cdata-sections", Boolean.FALSE},
              {"cdata-sections", Boolean.TRUE},
              {"check-character-normalization", Boolean.FALSE},
              {"comments", Boolean.FALSE},
              {"comments", Boolean.TRUE},
              {"datatype-normalization", Boolean.FALSE},
              {"entities", Boolean.FALSE},
              {"entities", Boolean.TRUE},
              {"error-handler", handler},
              {"infoset", Boolean.TRUE},
              {"namespaces", Boolean.TRUE},
              {"namespace-declarations", Boolean.TRUE},
              {"namespace-declarations", Boolean.FALSE},
              {"normalize-characters", Boolean.FALSE},
              {"split-cdata-sections", Boolean.TRUE},
              {"split-cdata-sections", Boolean.FALSE},
              {"validate", Boolean.FALSE},
              {"validate-if-schema", Boolean.FALSE},
              {"well-formed", Boolean.TRUE},
              {"element-content-whitespace", Boolean.TRUE},

              {"charset-overrides-xml-encoding", Boolean.TRUE},
              {"charset-overrides-xml-encoding", Boolean.FALSE},
              {"disallow-doctype", Boolean.FALSE},
              {"ignore-unknown-character-denormalizations",
                                                 Boolean.TRUE},
              {"resource-resolver", resolver},
              {"resource-resolver", null},
              {"supported-media-types-only", Boolean.FALSE},
          };

          public static void main(String [] args) throws Exception {
              DOMImplementation domImpl
                  = DocumentBuilderFactory.newInstance().newDocumentBuilder()
                    .getDOMImplementation();

              DOMImplementationLS lsImpl
                  = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");

              LSParser lsParser = lsImpl.createLSParser(
                   DOMImplementationLS.MODE_SYNCHRONOUS,
                   null);

              DOMConfiguration config = lsParser.getConfig();

              for(int i = values.length; --i >= 0; ) {
                  Object val = values[i][1];
                  String param = (String)values[i][0];
                  try {
                      config.setParameter(param, val);
                      Object returned = config.getParameter(param);
                      if ((val != null && !val.equals(returned))
                       || (val == null && returned != null)) {
                          System.out.println("'" + param + "' is set to "
                                + returned + ", but expected " + val);
                      }
                  } catch (DOMException e) {
                      System.out.println("setting '" + param + "' to "
                                       + val + " throws \n\t" + e);
                  }
              }
          }
      }
      ----------------------------------------------------

      ------------------------------------------------ log
      $javac test.java && java -cp . -showversion test
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b30)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b30, mixed mode)

      setting 'supported-media-types-only' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter supported-media-types-only is not recognized.
      setting 'resource-resolver' to null throws
              org.w3c.dom.DOMException: TYPE_MISMATCH_ERR: The value type for this parameter name is incompatible with the expected value type.
      setting 'ignore-unknown-character-denormalizations' to true throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter ignore-unknown-character-denormalizations is not recognized.
      setting 'disallow-doctype' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter disallow-doctype is not recognized.
      setting 'element-content-whitespace' to true throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter element-content-whitespace is not recognized.
      setting 'split-cdata-sections' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter split-cdata-sections is not recognized.
      setting 'split-cdata-sections' to true throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter split-cdata-sections is not recognized.
      setting 'normalize-characters' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter normalize-characters is not recognized.
      setting 'namespace-declarations' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_SUPPORTED: The parameter namespace-declarations is recognized but the requested value cannot be set.
      setting 'infoset' to true throws
              org.w3c.dom.DOMException: FEATURE_NOT_SUPPORTED: The parameter infoset is recognized but the requested value cannot be set.
      setting 'check-character-normalization' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_FOUND: The parameter check-character-normalization is not recognized.
      setting 'cdata-sections' to false throws
              org.w3c.dom.DOMException: FEATURE_NOT_SUPPORTED: The parameter cdata-sections is recognized but the requested value cannot be set.
      ----------------------------------------------------

      ======================================================================

            jsuttorsunw Jeff Suttor (Inactive)
            reysunw Rey Rey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: