castor
  1. castor
  2. CASTOR-2162

Refactor the way Castor XML currently deals with XML parsers

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.1.2.1
    • Fix Version/s: 1.2
    • Component/s: XML
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Currently, Castor XML never uses JAXP to instantiate an XML parser, but always creates an instance of Xerces (as defined by the value of the org.exolab.castor.parser property). With this property set, Castor XML will not use JAXP, but use Class.forName() to instantiate a XML parser instance.

      Whilst this works in principle, this creates problems for users on different JDKs, as the class name for the Xerces parser is different on Java 5 from what it used to be with Java 1.4 and earlier.

      The solution is to comment out this property (and make it clear that it can be used to override the default JAXP mechanisms), and to rely on JAXP for XML parser instantiation. This has the benefit that this will work out of the box for both JDK 1.4 and JDK 5.0 (and higher) without any properties to be changed in custom castor.properties files.

      1. patch.c2155.20070822.txt
        17 kB
        Werner Guttmann
      2. patch.c2162.20070823.txt
        30 kB
        Werner Guttmann

        Issue Links

          Activity

          Hide
          Werner Guttmann added a comment -

          A possible solution will have to touch the default castor.properties file, and the following classes:

          a) org.exolab.castor.xml.Configuration
          b) org.exolab.castor.xml.LocalConfiguration

          to refactor some of the code duplication.

          Show
          Werner Guttmann added a comment - A possible solution will have to touch the default castor.properties file, and the following classes: a) org.exolab.castor.xml.Configuration b) org.exolab.castor.xml.LocalConfiguration to refactor some of the code duplication.
          Hide
          Werner Guttmann added a comment -

          Initial patch for review.

          Show
          Werner Guttmann added a comment - Initial patch for review.
          Hide
          Werner Guttmann added a comment -

          So far, I have tested this against XML APIs and Xerces(Impl) 2.6.2. Still need to test this against plain Xerces 1.4.0.

          Show
          Werner Guttmann added a comment - So far, I have tested this against XML APIs and Xerces(Impl) 2.6.2. Still need to test this against plain Xerces 1.4.0.
          Hide
          Werner Guttmann added a comment -

          Initial patch for review.

          Show
          Werner Guttmann added a comment - Initial patch for review.
          Hide
          Werner Guttmann added a comment - - edited

          With regards to testing, this works so far against ...

          a) JDK 1.4, XML-APIs + Xerces 2.6.2 (implementation), no custom parser property
          b) JDK 1.4, XML-APIs + Xerces 2.6.2 (implementation), custom parser property set to Xerces
          c) JDK 1.4, Xerces 1.4.0, no custom parser property
          d) JDK 1.4, Xerces 1.4.0, custom parser property set to Xerces

          Show
          Werner Guttmann added a comment - - edited With regards to testing, this works so far against ... a) JDK 1.4, XML-APIs + Xerces 2.6.2 (implementation), no custom parser property b) JDK 1.4, XML-APIs + Xerces 2.6.2 (implementation), custom parser property set to Xerces c) JDK 1.4, Xerces 1.4.0, no custom parser property d) JDK 1.4, Xerces 1.4.0, custom parser property set to Xerces

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Werner Guttmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours, 30 minutes
                2h 30m
                Remaining:
                Remaining Estimate - 2 hours, 30 minutes
                2h 30m
                Logged:
                Time Spent - Not Specified
                Not Specified