Results 1 to 2 of 2
  1. #1
    roddy is offline Member
    Join Date
    Aug 2009
    Location
    California
    Posts
    2
    Rep Power
    0

    Default Castor Mapping - Help

    Hello everyone,

    I am having a problem converting an XML into a Java object. I am getting a NullPointerException at org.exolab.castor.xml.UnmarshalHandler.endElement( UnmarshalHandler.java:937), but I believe that the error is caused by the "duplicate" child elements - firstName under payeeName and firstName under recipientName (see the xml below).
    I've tried different things to resolve the problem but nothing helped and I ran out of ideas.
    I'd greatly appreciate your help. Please let me know what's wrong with the mapping file.
    Note: I replaced the links with {url}, because I don't have the right to submit links.

    Thanks.

    Here's the xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <info xmlns="{url}/MyData" xmlns:types="{url}/my_types" xmlns:xsi="{url}/XMLSchema-instance" xsi:schemaLocation="{url}/MyData/my_data.xsd ">
    <data>
    <payeeName>
    <types:firstName>firstName</types:firstName>
    </payeeName>
    <recipientName>
    <types:firstName>firstName2</types:firstName>
    </recipientName>
    </data>
    </info>

    Here's my mapping file:
    <?xml version="1.0"?>
    <mapping>
    <class name="MyData">
    <map-to xml="data" ns-uri="{url}/my_types" ns-prefix="types"/>
    <field name="payeeFirstName" type="java.lang.String" direct="true">
    <bind-xml name="firstName" node="element" type="Name" location="payeeName" />
    </field>
    <field name="recipientFirstName" type="java.lang.String" direct="true">
    <bind-xml name="firstName" node="element" type="Name" location="recipientName" />
    </field>
    </class>
    </mapping>

    My java class is
    public class MyData {
    public String payeeFirstName;
    public String recipientFirstName;
    }

  2. #2
    roddy is offline Member
    Join Date
    Aug 2009
    Location
    California
    Posts
    2
    Rep Power
    0

    Default Solution?

    Since I did not get any replies, I transformed the original xml, using xsl, renaming the "duplicate" nodes. It worked.

Similar Threads

  1. Can some one help castor mapping
    By mjyotira in forum XML
    Replies: 0
    Last Post: 07-20-2009, 12:19 PM
  2. XML and Database Mapping in .NET
    By gilbertsavier in forum XML
    Replies: 0
    Last Post: 07-17-2009, 08:34 AM
  3. Servlet mapping
    By cozsmin in forum Java Servlet
    Replies: 1
    Last Post: 04-04-2009, 10:15 AM
  4. xml mapping error with JPA in RAD, RSA
    By ishakteyran in forum Other IDEs
    Replies: 0
    Last Post: 02-05-2009, 09:00 PM
  5. xml mapping error with JPA
    By ishakteyran in forum XML
    Replies: 0
    Last Post: 02-05-2009, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •