On Jan 15, 2008, at 1:58 PM, Werner Guttmann wrote:

Brett,

I will be looking into this within a short time, but just out of curiosity, what happens if you changed the isbn to to of type element rather than attribute ?

Sure, I could go with something like this:

<?xml version="1.0"?>
<book>
 <book-info>
   <isbn>9780446618502</isbn>
 </book-info>
 <title>The Book of the Dead</title>
</book>

Then, the mapping would look like:

<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0// EN" "http://castor.org/mapping.dtd";>

<mapping>
  <class name="ibm.xml.castor.Book">
    <map-to xml="book" />

    <field name="Title" type="java.lang.String">
      <bind-xml name="title" />
    </field>
    <field name="Isbn" type="java.lang.String">
      <bind-xml name="isbn" node="element" location="book-info" />
    </field>
  </class>
</mapping>

Unfortunately, the result is the same:

Jan 15, 2008 2:04:53 PM org.exolab.castor.mapping.Mapping setBaseURL
INFO: book-mapping.xml is not a URL, trying to convert it to a file URL
Jan 15, 2008 2:04:53 PM org.exolab.castor.mapping.Mapping loadMapping
INFO: Loading mapping descriptors from book-mapping.xml
Jan 15, 2008 2:04:54 PM org.exolab.castor.xml.UnmarshalHandler startElement WARNING: unable to find FieldDescriptor for 'book-info' in ClassDescriptor of book Jan 15, 2008 2:04:54 PM org.exolab.castor.xml.UnmarshalHandler endElement
INFO: Ignoring isbn no descriptor was found
Jan 15, 2008 2:04:54 PM org.exolab.castor.xml.UnmarshalHandler endElement
INFO: Ignoring book-info no descriptor was found
Book ISBN: null
Book Title: The Book of the Dead
null

Obviously, I could make isbn a child element of the book element, but the idea here is to show how mapping works, so that sort of defeats the purpose :-)

Thanks for your help.

Thanks
---
Brett McLaughlin
---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to