1. castor
  2. CASTOR-606

Unmarshall SAXException on non-unique XML name


    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s:
    • Fix Version/s: None
    • Component/s: XML
    • Labels:
    • Environment:
      Operating System: Windows 2000
    • Bugzilla Id:
    • Number of attachments :


      The following points identify the problem I am having.
      1. The element name "Effective_Date" and value exists in the xml file under
      a "Group" level and is mapped to a java class using a mapping.xml file.
      2. The same element name, "Effective_Date", is added to the same xml file in a
      different location "Group_Plan" and is not mapped in the mapping.xml file.
      3. The file has the following setting:
      org.exolab.castor.xml.strictelements=false (If new elements are added and not
      mapped, I want to ignore these). I also used "setIgnoreExtraElements(true)"
      which does the same thing. I set the latter to false, just to prove that other
      elements that were not mapped were being ignored; and they were.
      4. If the newly added element name is changed to a unique name, such as
      Effective_Date2, it does not cause an error. Again Effective_Date2 is not
      5. I am actually using JDK1.4/IBM.
      6. The following is the actual error message:
      org.xml.sax.SAXException: unable to add 'Effective_Date' to <Group_Plan> due to
      the following exception:
      >>>--- Begin Exception ---<<<
      java.lang.IllegalArgumentException: Type conversion error: could not set value
      of Group_Effective_Date(java.lang.String) with value of type java.lang.String
      7. The following is the snippet from the xml file that shows two
      elements "Effective_Date" that are defined in different locations. The one in
      Group_Plan is not defined in the corresponding java class. I indented this as
      well as I could, but the wrap-around makes it harder to see.
      <Group_Name>All RRs Medicare Elig in Premier Plan</Group_Name>
      <Bill_Group_Name>All EEs</Bill_Group_Name>
      <Market_Type_Name>PCP/Wide Access</Market_Type_Name>





      8. In the mapping file, I tried adding a location for the Group level
      Effective_Date. This did not alter the result. Below is that specific code. I
      also tried it without the 'node = "element"' and it did not alter the result.
      <field name="Group_Effective_Date" type="string" required="true">
      <bind-xml name="Effective_Date" node = "element" location="Customer/Group"/>
      9. In the mapping file, I tried the following code, but it also had no effect
      on the error.
      <class name="">
      <map-to xml="Customer.Group"/>


        Bruce Snyder made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 1467 22905
        Ralf Joachim made changes -
        Assignee Keith Visco [ kvisco ]


          • Assignee:


            • Created: