Hi Castor group,

 

 Please help...  Unmarshaller.unmarshall(Class, org.w3c.dom.Document) is not producing the expected result when there are name spaces in document.

 

 Details:

 

 I have a JavaBean called Person.java which I generated from Person schema and my person document look like this..

 

 Dom object (dom)

 -----------------

 <?xml version="1.0" ?>

<person xmlns="urn:webservice15">

  <name>myName</name>

  <address>myAddress</address>

  <ssn>111-222-3333</ssn>

  <email>[EMAIL PROTECTED]</email>

  <home-phone>123355678</home-phone>

  <work-phone>1233455678</work-phone>

</person>

 

Infact  I created my JavaBean Person.java from this person.xml file using  castor tools.

Person.xml->person.xsd->Person.java.

 

Now when I call

Person person = (Person) 

             Unmarshaller.unmarshal(Person.class,

               dom);

     System.out.println("Person Attributes");

     System.out.println("-----------------");

     System.out.println("Name: " + person.getName() );

     System.out.println("Address: " + person.getAddress() );

     System.out.println("SSN: " + person.getSsn() );

     System.out.println("Email: " + person.getEmail() );

     System.out.println("Home Phone: " +

                             person.getHomePhone() );

     System.out.println("Work Phone: " + 

                             person.getWorkPhone() );

 

All values are null unless I remove explicitly xmlns from my person element.

 

Could any one extend a hand of help?

 

Thanks,

Ranjith Pillai

 

 

Reply via email to