Unmarshalling with Castor problem

Hello everyone, i have run into a small problem with unmarshalling. Lets say my xml is something like this:
    <Client>
      <Name>a</Name>
      <Something>b</Something>
   </Client>Then everything works, i unmarshal it into a Client Object.
public class Client{
   //getters and setters
}Also i have a mapping, but now if my XML is something like this:
<Book>
   <Page1>
      <Client>
            <Name>a</Name>
            <Something>b</Something>
      </Client>
   </Page1>
</Book>Then what would the mapping be and how do i get the Client object out of it. I tried creating a class for every element.
like
public class Book{
   getBook(){
      //return the book object
}Then
public class Page{
   getPage(){
   //return the page
}So to get the client object i first unmarshalled the Book object, then i did Book.getPage().getClient().getName(); And then i got Nullpointer exception. How do i parse documents like that?
Thanks

here is the weird thing though...in my debugconsole,
I can see the value of source, cuz the content of my
XML file is in the source, but the
parser.parse(source) is called, the content of my
source is NULL...and I think that is why I amgetting
null on my service result every time...I'm not sure what you mean here. You are saying that
you can see the source in a variable (???) and then in
another variable it's null or what?sorry...My bad....no...
parser.parse(InputSource source)...does that sound more clear???
You know how you can see the stack in debug console, what i saw before the Parser.parse(InputSource source) called is
source->characterStream:java.io.reader->str: <xml version='1.2'><name>moe</name><last name>zoe</lasname>...
HOwever, after the Parser.parse(InputSource source) is called, i inspected the stack again, i got
source->characterStream:java.io.reader->str: NULL
that is why i suspect that i got a null serviceResult on my return...
any ideas?? how that happened?? many thanks...

Similar Messages

  • Problem with castor xml mapping

    Hi,
    we have following problem with castor xml mapping.
    How to use references in the collections(Hashmap or vector)?
    WE have a method called getAttribute map which will return a hashmap consist different type of objects. We want to keep only the
    references of objects if that object occurs more than once,instead of keeping the whole object
    Following is the the xml mapping file.
    <mapping>
    <class name="com.opvista.ndtool.core.mos.ManagedObject" identity="Id" auto-complete="false" verify-constructable="false">
    <map-to xml="ManagedObject"/>
    <field name="Id" get-method="getId" set-method="setId" type="string">
    <bind-xml name="Id" node="attribute"/>
    </field>
    <field name="AttributeMap" type="org.exolab.castor.mapping.MapItem" collection="map" get-method="getAttributeMap">
    <bind-xml name="AttributeMap" node="element">
         <class name="org.exolab.castor.mapping.MapItem">
    <field name="key" type="java.lang.Object">
         <bind-xml name="key" node="attribute"/>
    </field>
    <field name="value" type="java.lang.Object">
         <bind-xml name="value" node="element" reference="true"/>
         </field>
    </class>
         </bind-xml>
    </field>
    </class>
    </mapping>
    we are using reference=true for the values. But it will throw below exception.
    Unable to resolve ID for instance of class 'java.lang.String' due to the following error: Unable to resolve ClassDescriptor.
         at org.exolab.castor.xml.Marshaller.getObjectID(Marshaller.java:1988)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1628)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1831)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1814)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1825)
         at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:821)
    Please help us to overcome from this problem?
    Thanks,
    Dileep

    for your ref here is what i think the basic mapping file would look like
    <class name="Person">
    <map-to xml="person"/>
    <field name="name" type="string">
    <bind-xml name="name" node="attribute" />
    </field>
    <field name="age" type="string">
    <bind-xml name="age" node="attribute" />
    </field>
    </class>
    <class name="MetaPerson">
    <map-to xml="person"/>
    <field name="dependents" type="string">
    <bind-xml name="dependents" node="attribute" />
    </field>
    <field name="presentAdd" type="string">
    <bind-xml name="present_add " node="attribute" />
    </field>
    <field name="permanentAdd" type="string">
    <bind-xml name="permanent_add " node="attribute" />
    </field>
    </class>
    however i am still not clear as to how i can use the metaperson object in the person class as well as in the mapping file.
    hope this gives a better idea abt my problem statement.
    Please help me out

  • [Castor] Problem with the namespace

    Hello,
    I'm using Castor for generate XML file with Java Object(generate with Castor with XSD).
    I have a problem with the syntax and particulary with the reference of the namespace.
    I obtain this :
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST ID="">
    <ns1:PERSON xmlns:ns1="http://www.w3.org/a/">
    <ns1:CALCUL>
    <ns1:SOURCE>RED</ns1:SOURCE>
    <ns1:TIMESTAMP>2004-10-27-11.38.25.237113</ns1:TIMESTAMP>
    </ns1:CALCUL>
    <SIREN>666</SIREN>
    <ns1:DOSSIER>
    <ns1:TYPE>DN</ns1:TYPE>
    <ns1:IDENTIFIANT>333</ns1:IDENTIFIANT>
    </ns1:DOSSIER>
    </ns1:PERSON>
    <ENTITY>
    <COMMON>
    <ns2:ENTITY_ID xmlns:ns2="http://www.w3.org/a/">602449226</ns2:ENTITY_ID>
    <ns3:RATING xmlns:ns3="http://www.w3.org/a/">NDE</ns3:RATING>
    </COMMON>
    <SPECIFICS_DATA>
    <ns4:RATING_FC xmlns:ns4="http://www.w3.org/a/">2-</ns4:RATING_FC>
    </SPECIFICS_DATA>
    </ENTITY>
    </TEST>
    but I'd like to obtain :
    <TEST ID="">
    <PERSON >
    <CALCUL>
    <nSOURCE>RED</SOURCE>
    <TIMESTAMP>2004-10-27-11.38.25.237113</TIMESTAMP>
    </CALCUL>
    <SIREN>666</SIREN>
    <nDOSSIER>
    <TYPE>DN</TYPE>
    <IDENTIFIANT>333</IDENTIFIANT>
    </DOSSIER>
    </PERSON>
    <ENTITY>
    <COMMON>
    <ENTITY_ID >602449226</ENTITY_ID>
    <RATING>NDE</RATING>
    </COMMON>
    <SPECIFICS_DATA>
    <RATING_FC >2-</RATING_FC>
    </SPECIFICS_DATA>
    </ENTITY>
    </TEST>
    "http://www.w3.org/a/" is the namespace reference in the xsd, here the begin of the xsd:
    <xs:schema xmlns:FIN_Referential="http://www.w3.org/c/" xmlns:Rating_Referential="http://www.w3.org/f/" xmlns:Global_Referential="http://www.w3.org/a/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    To marshall I use this code :
    StringWriter fluxXmlSw = new StringWriter() ;
    Marshaller mar = new Marshaller(fluxXmlSw);
    mar.marshal(Test(),fluxXmlSw);
    //Test() is the root element of the file xml
    I hope somebody could help me, it's urgent I solve this problem.
    Thanks for all responses

    just a thought..... did u try removing xmlns:p1="http://ofcom.co.uk/unify/CustomerMaster" from your WSDL file ?
    Try to remove that and proceed in your development.

  • XML binding(maping) "Castor" problem ...

    Hello Dear Sirs !
    I am using the the "Castor" project for XML Binding purposes .
    It was really good idea to create this stuff .
    I tried to use it in my programs and just surprised how your project really tailored to XML programmers needs .
    But a some time ago I have encountered with some Parsing problem ....
    May be my quastion is to stooped , but i still can not find an answer .
    I have to parse From Java Class to XML and Vice Versa next kind of XML :
    ************************ First Question *****************************************
    <Inputs>
    < Line LineNumber = '0'
    Selected 'yes'
    Attribute='Value of Attribute'
    IDFormat='Format to Apply'
    <Value Name ='Rate'>4.89</Value>
    <Value Name ='Subscribtion'>yes</Value>
    <Value Name ='EnrolmentDate'>12.12.2002</Value>
    <Value Name ='ProviderName'>Somebody</Value>
    </Line>
    < Line LineNumber = '1'
    Selected 'no'
    Attribute='Value of Attribute'
    IDFormat='Format to Apply'
    <Value Name ='Queue'>2Q</Value>
    <Value Name ='IVR'>yes</Value>
    <Value Name ='EnrolmentDate'>31.12.2002</Value>
    </Line>
    < Line LineNumber = '3'
    Selected 'yes'
    Attribute='Value of Attribute'
    IDFormat='Format to Apply'
    <Value Name ='CustomerName'>NA</Value>
    <Value Name ='Vacancy'>yes</Value>
    </Line>
    </Inputs>
    ************************ End of First Question ***************************
    *********************** Second Question ***************************
    <Inputs>
    Value< ItemAttribute = 'CurentItemAttribute' ItemProperty =' ItemProperty' >
    Value<ItemAttribute = 'CurentItemAttribute' >
    Value<ItemProperty =' ItemProperty' >
    Value< ItemAttribute = 'CurentItemAttribute' ItemProperty =' ItemProperty' >
    Value<ItemAttribute = 'CurentItemAttribute' >
    Value< ItemAttribute = 'CurentItemAttribute' ItemProperty =' ItemProperty' >
    Value< ItemAttribute = 'CurentItemAttribute' ItemProperty =' ItemProperty' >
    </Inputs>
    *********************** End of Second Question ***************************
    And I dont know How I can MAP these XML formats to Java Classes and vice versa .........
    (to my pitty It is not my idea to assemble it in this manner and this is not given to some improvement change .... )
    In your examples all things look so simple and understandable ... but I have no idea about my case .....
    Please , help me with this ....
    Are these kinds of XML can be really somehow binded and work together with "Castor" ?
    It it really possible to do these things ?
    I will really appreciate your attempt to help me .
    Thank you ,
    Marat

    To create class file for binding in castor, your first step is to create an XML Schema or .xsd file. Then assuming it is installed correctly type: java org.exolab.castor.builder.SourceGenerator -i whatever.xsd -package com.xyz.myxml.castor
    This would create the java class file in the package com.zyx.myxml.castor that corresponds to your XML schema

  • My iPhone 6 ear speaker is not working properly I couldn't able to hear any thing from ear speaker to lissen I had to put on loud speaker or to use handsfree please help me out with this problem if some body have answer?

    My iPhone 6 ear speaker is not working properly I couldn't able to hear any thing from ear speaker to listen I had to put on loud speaker or to use hands free please help me out with this problem if some body have answer?

    Hi Venkata from NZ,
    If you are having an issue with the speaker on your iPhone, I would suggest that you troubleshoot using the steps in this article - 
    If you hear no sound or distorted sound from your iPhone, iPad, or iPod touch speaker - Apple Support
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • HT1386 I just reinstalled my windows operating system and decided to put on windows 8.  After loading all of my music back into a freshly installed itunes, my 4th gen ipod is not recognized by itunes.  My 1st gen ipod nano works with no problem.  Help!

    reinstalled my windows operating system and decided to put on windows 8.  After loading all of my music back into a freshly installed itunes, my 4th gen ipod is not recognized by itunes.  My 1st gen ipod nano works with no problem.  I can eliminate any problems with the cable and connection.
    I've stopped and started the service, and also have performed cold reboots.
    Nothing seems to have helped the situation.
    Help!

    See:
    iOS: Device not recognized in iTunes for Windows
    I would start with
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    iTunes for Windows: Device Sync Tests
    Have you tried on another computer to help determine if you have a computer or iPod problem?
    The iPod Classic uses different drivers than the Nano

  • Can anyone help me with a problem i am having with my music on my iPhone 4S. I have put alot of Compilation CDs in my library on iTunes. I download these tracks onto my phone, everything is ok so far. Now, this is what is niggling me and I don.t know how

    Can anyone help me with a problem i am having with my music on my iPhone 4S. I have put alot of Compilation CDs in my library on iTunes. I download these tracks onto my phone, everything is ok so far. Now, this is what is niggling me and I don.t know how to resolve it. This is my problem: 
    Have downloaded for example: Queen – Bohemium Rhapsody from a compilation album as well as a few complete Queen Album CDs into the iTunes library and then put them into playlists,
    When I go onto my phone and select Queen on the MUSIC app using Songs tab at the bottom of the screen it will display all Queen songs and their resective Alum pics, that is all those not in a complilation album, .
    If I know the song title I can select the songs tab and find the song that way,
    I’ve tried fiddling with the settings in the iTunes app by going to ‘get info’ tab and trying to sort the problem out that way but am not having much luck.What I want the phone to do is show, for example all Queens songs including those in compilation albums. Can this be done, would be grateful for any ideas on how it can be done, that is if ic can be done, any ideas
    Thanks for your help

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Monitors with Gradient Problems?

    Hi All,
    Further to my recent post "monitor screen display terrible!"
    Finding a monitor without spending a lot with excellent picture quality is proving differcult! I have tried a Philips 22" monitor Model 220CW9FB and now a BENQ T900HD 18.5 WS monitor all not as sharp with good contrast as my 4 year old G5 iMac. Also has a gradient problem e.g. as you get up off your chair and continue to look down at the screen the white background of the screen turns light blue then darker and colored parts turn white!? Also looking at an angle to the side anything light blue turns a light brown!? Then as I'm viewing something as in Apple Discussions each box of replies alternate white then light blue and so on but looking at normal distant as you type each box are white. You have to lean back in your chair, twice the distance back to actual see the blue box then white box!?
    What's that all about? I have noticed this on the new 20" iMacs too but the three new 24" iMacs are great just like my Rev A G5 iMac of 4 years. Are these inferior screen problems anything to do with them being TN panels as I've just read about?
    I really don't know where to go from here as the screen quality is important. I'm use to the great screen quality of my old G5 iMac and don't want to go down in quality for the sake of moving from a Mac PowerPC to an Intel Core 2 Duo even though I need this for EyeTV hybrid and all the features of iLife '09 etc.
    I don't want to spend a huge amount for an Apple display as I might as well get the entry level 24" iMac. The main reason for not getting the new iMac is I don't like the glossy screen, although today I heard there is an option for a 24" matt screen... any truth in that? Then again will I be able to return the new Mac mini I've only had for 6 days for a 24" iMac?
    Other suggestions seen here is turning my G5 iMac into a stand-a-loan monitor or maybe a 20-year-old CRT 19" TV I have can be used as a monitor and if so what connections are needed? Any ideas on these options?
    So buying the new Mac mini has created a lot of unexpected problems. I thought as asked about before getting it was told any monitor would have the same picture quality as my old G5 iMac, but after the fact found out this is not the case.
    Thanks for the read & any ideas/thoughts much appreciated...

    AFAIK Hmmm Googled "As Far As I Know"... So far I've tried three monitors (all with gradient problem) so it looks like you are correct. I'll try a couple more today as if I need to return my Mac mini with Philips monitor need to do soon for a 24" new iMac even though the Mac mini is not at fault. I'll have to get use to the glossy screen. While writing this an item "iMac or MacBook display too glossy? Apply inexpensive non-glare LCD protective film" has appeared in MacDailyNews.
    http://macdailynews.com/index.php/weblog/comments/20561/
    Thanks for the idea using my G5 as a monitor but maybe quite an involved process?
    It's a shame in all my research before buying a monitor no salesperson mentioned TN display panels. Mind you since the problem no salesperson has said they know about TN display panels or better monitors, just saying any monitor will work with the new Mac mini. Very frustrating!

  • I have a wireless network at home. I run my iphone and ipad on it with no problems. Just purchased a MacBook Pro, and now my wi-fi keeps disconnecting and i get an error message saying another device is using the same IP address. What does all this mean?

    I have a wireless network at home. I run my iphone and ipad on it with no problems. Just purchased a MacBook Pro, and now my wi-fi keeps disconnecting and i get an error message saying another device is using the same IP address. What does all this mean?

    Hello AKCamus
    To give you some ideas of what to do next, I have provided a few articles that will give some troubleshooting Wi-Fi connections and recommended Wi-Fi settings.
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/kb/HT4199
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    Troubleshooting Wi-Fi issues in OS X Lion and Mac OS X v10.6
    http://support.apple.com/kb/HT4628
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • I bougt a new  Macbook pro in 02/26/2013, in  11/25/ 2013, my trackpad become bulging, they exchange the trackpad, but not the bulging battery.  I went there yesterday, with different problem, and they said one screw  came off from the  truckpad again!

    I bought a new  Macbook pro in 02/26/2013 from Apple Canadian Ices -003.  Than I could not use it, because  my cursor uncontrollably  was jumping around the screen, I was  resumed my trackpad become bulging, Than on11/25/ 2013 they changed my trackpad for free, because was manufactoring defect,  but not the bulging battery.  They said that is do not needed.  Since that my cursor is quiet often quivering, I think my Macbook has serious  manufacturing defect. But they said no, during a year period I went to  the genius bar at least 15 times, with this and similar problems.   I went there yesterday, with different problems, and they said one of the screws  came off from my   truck pad, therefore they need to fix it and change it.  I said: -  What,  how, what  is the real problem?  A screw does not comes off just like that?  They will change my trackpad again, but not the battery. They said  has to rebuild the operation system, I'm  saving all of my data right now! I would like to exchange the battery too, or maybe get a new Macbook. My Macbook is 2010 China model. How long I would have this trackpad  problem? What are you suggesting?

    If it's a 2010 as you say towards the end of your post, it's out of warranty. The battery isn't covered in that case. Why don't you just buy a new battery if that's your concern? If it's a 2013 as you say up at the top, it shouldn't have a bulging battery. How do you know it does? If it really does, ask for the store manager and explain the problem.

  • I need advise and help with this problem . First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product . At the present time I'm having lots of problems with the router so I was looking in to

    I need advise and help with this problem .
    First , I have been with Mac for many years ( 14 to be exact ) I do have some knowledge and understanding of Apple product .
    At the present time I'm having lots of problems with the router so I was looking in to some info , and come across one web site regarding : port forwarding , IP addresses .
    In my frustration , amongst lots of open web pages tutorials and other useless information , I come across innocent looking link and software to installed called Genieo , which suppose to help with any router .
    Software ask for permission to install , and about 30 % in , my instinct was telling me , there is something not right . I stop installation . Delete everything , look for any
    trace in Spotlight , Library . Nothing could be find .
    Now , every time I open Safari , Firefox or Chrome , it will open in my home page , but when I start looking for something in steed of Google page , there is
    ''search.genieo.com'' page acting like a Google . I try again to get raid of this but I can not find solution .
    With more research , again using genieo.com search eng. there is lots of articles and warnings . From that I learn do not use uninstall software , because doing this will install more things where it come from.
    I do have AppleCare support but its to late to phone them , so maybe there some people with knowledge , how to get this of my computer
    Any help is welcome , English is my learned language , you may notice this , so I'm not that quick with the respond

    Genieo definitely doesn't help with your router. It's just adware, and has no benefit to you at all. They scammed you so that they could display their ads on your computer.
    To remove it, see:
    http://www.thesafemac.com/arg-genieo/
    Do not use the Genieo uninstaller!

  • I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

    I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • I was using same id on 2 iphones with no problems suddenly everything got mess, how can i set a new id w.out losing my contacts?

    i was using same id on 2 iphones with no problems suddenly everything got mess, how can i set a new id w.out losing my contacts?

    I believe because you migrated from a Nokia to an iPhone you need to register the Bn phone number with your Apple ID so it can be used for iMessage. The Pn number seems to be the only one registered
    Go here > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    Manage your Apple ID and see if that does the trick
    Hope that helps

  • It says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    I just got my new iPad Mini2, and when I choose "sign in with your apple ID", it says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?

    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings

  • I set up my iCloud account on iPad with an exchange account and aol account.  I can see exchange and aol emails but not those from .me account or apple email.  I got it to show all 3 accounts on my iPhone with no problem.  Hat am I missing?

    I set up my iCloud account on iPad with an exchange account and aol account.  I can see exchange and aol emails but not those from .me account or apple email.  I got it to show all 3 accounts on my iPhone with no problem.  Hat am I missing?

    I'm having a similar problem, but I do have the key and is not working anyway.
    My old pc was running on windows 7 and my new one is an apple running on Lion.
    My phone is an Iphone IV and I can see all the bookmarks there.
    In order to sync, what I did was click on the "I don't have the device with me", I entered the key that was provided and the process finish ok. It says congratulations, etc, etc.
    But the bookmarks are not there, I tried merging data and replacing data on this computer options but is the same.
    Any suggestions?

Maybe you are looking for

  • Is it right to mix sizes of memory modules in a mac mini 2012? for example 2Gb 8Gb?

    Is it right to mix sizes of memory modules in a mac mini 2012? for example 2Gb 8Gb?

  • How to change the endpoint url of the siebel service ?

    Hi All, JDev : 11.1.1.5 I am fetching data from the siebel webservice. I created the proxy client from the Siebel WSDL in the JDeveloper. It was working fine. Now the endpoint URL(Server) is changed. This service fails to connect to that server. The

  • Extend xml for orders by BBP_SAPXML1_OUT_BADI

    Hi, We need to extend xml order export with specifical xml flag. We have some samples for extend catalogs (extend by structure TYPE BBPX1_CATALOG_TRANSMISSION), but we dont have such a structure in the order badi (the structure TYPE BBPX1_PURCHASE_OR

  • Best books for *real* newbies?

    Hi, I need a good tutorial that assumes absolutely nothing about Java or much programming knowledge aside from knowing that boolean means either or, and that string is text. Is there such a thing? I've been to javaranch.com and it's close and the cup

  • OAF : Dialog page issue

    Hi All, I am tyring to code dialog page , on 'SUBMIT' button click ( I call it 'POST TO GL' button ). But the below code, does not call the posing PLSQL procudeure on 'YES' button click. Can some one throw light if I am missing anything ? -----------