Dennis--

Thank you for the reply, that was EXACTLY the problem.
A system property was not getting set correctly.
I have that problem now corrected.
However, now I have this problem and I believe it is similar to the JIRA Bug
#14, but not entirely sure.

Here is the situation.
I have the following XML file:
 
<job>
        <jobStatus>new</jobStatus>
        <jobID>111</jobID>
        <jobType>EDRInspection</jobType>
        <technicianID>012345</technicianID>
        <inventoryLocation>CHIRIL</inventoryLocation>
        <inspectionRepairLocation>IR</inspectionRepairLocation>
        <accountCode>425</accountCode>
        <jobCode>105</jobCode>
        <cause>damage</cause>
        <jobPosition>09</jobPosition>
        <damagePosition>11</damagePosition>
        <damagedArea>roof</damagedArea>
        <correctionCode/>
        <condition>cracked</condition>
        <workPerformed/>
</job>
<job>
        <jobStatus>new</jobStatus>
        <jobID>112</jobID>
        <jobType>Repair</jobType>
        <technicianID>012345</technicianID>
        <inventoryLocation>CHIRIL</inventoryLocation>
        <inspectionRepairLocation>IR</inspectionRepairLocation>
        <accountCode>425</accountCode>
        <jobCode>105</jobCode>
        <cause>damage</cause>
        <jobPosition>09</jobPosition>
        <damagePosition>11</damagePosition>
        <damagedArea>roof</damagedArea>
        <correctionCode/>
        <condition>cracked</condition>
        <workPerformed/>
</job>

I have the following Binding file:
<binding>
  <mapping name="job" class="com.jbhunt.rdcc.application.OutboundJob">
    <value name="jobStatus" field="_jobStatus"/>
    <value name="jobID" field="_jobID"/>
    <value name="jobType" field="_jobType"/>
    <value name="technicianID" field="_technicianID"/>
    <value name="inventoryLocation" field="_inventoryLocation"
usage="optional"/>
    <value name="inspectionRepairLocation" field="_inspectionRepairLocation"
usage="optional"/>
    <value name="accountCode" field="_accountCode" usage="optional"/>
    <value name="jobCode" field="_jobCode" usage="optional"/>
    <value name="cause" field="_cause" usage="optional"/>
    <value name="jobPosition" field="_jobPosition" usage="optional"/>
    <value name="damagePosition" field="_damagePosition" usage="optional"/>
    <value name="damagedArea" field="_damagedArea" usage="optional"/>
    <value name="correctionCode" field="_correctionCode" usage="optional"/>
    <value name="condition" field="_condition" usage="optional"/>
    <value name="workPerformed" field="_workPerformed" usage="optional"/>
  </mapping>
</binding>

And I have the following java code to read from the xml and place into a
Java object:

public Vector getUserSpecificJobs(String technicianNumber)
        {
                Vector userStuff = new Vector();
                try
                {
                        IBindingFactory bfact =
BindingDirectory.getFactory(OutboundJob.class);
                        IUnmarshallingContext uctx =
bfact.createUnmarshallingContext();
                        FileInputStream uis = new
FileInputStream(RDCCProperties.USER_JOBS_DATA_STORE + technicianNumber +
".xml");
                        BufferedInputStream bis = new
BufferedInputStream(uis);
                        KXmlParser kxp = new KXmlParser();
                        kxp.setInput(bis, null);
                        kxp.nextTag();
                        kxp.require(KXmlParser.START_TAG, "", "job");
                        while(kxp.getEventType() == KXmlParser.START_TAG)
                        {
                                OutboundJob job =
(OutboundJob)uctx.unmarshalElement();
                                System.out.println("Found job \n" +
job.toString());
        
if(job.getTechnicianID().equals(technicianNumber))
                                {
                                        userStuff.add(job);
                                }
                        }
                }
        //...exceptions here
        }
        return userStuff;
}

This doesn't return any values in the Vector userStuff when I call it
passing a technicianNumber that matches the file on the local file system.
I get two JiBX exceptions of null when I run this.

Any thoughts???

Thanks,
Damon 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dennis Sosnoski
Sent: Thursday, July 15, 2004 2:39 PM
To: [EMAIL PROTECTED]
Subject: Re: [jibx-users] Newbie: Can't generate an XML file

I don't see anything wrong in what you're doing, at first glance. I'd
suggest adding some debugging code to your writeTempData method to print out
the actual file location (so generate it as a String, print it out, then do
the new FileOutputStream()). I suspect it's going somewhere other than where
you planned (or something else is going on and you're not executing the code
at all).

- Dennis

Damon Hill wrote:

>Good day.
> 
>Please excuse what I feel to be a very rudimentary post. 
>I am working on a wireless project to be ran on a PDA.
>Therefore I need something small and lightweight.
>I have XML data and am using Java and thus need to be able to go back 
>and forth easily between the two.
>Thus JIBX seems to be right up my alley.
>The documentation is straight forward and very easy to follow.
>However, I can't seem to get the following to work and produce a xml 
>file.
>Any thoughts and help would be more than greatly appreciated.
> 
>Java Code:
>public void writeTempData(OutboundJob currentJob) {
>       String technicianNumber = currentJob.getTechnicianID();
>       try
>       {
>               IMarshallingContext mctx =
>BindingDirectory.getFactory(OutboundJob.class).createMarshallingContext
>(
>);
>               mctx.setIndent(4);
>               java.io.FileOutputStream os = new
>java.io.FileOutputStream(RDCCProperties.TEMP_DATA_STORE + 
>technicianNumber);
>               mctx.marshalDocument(currentJob, "UTF-8", null, os);
>               os.close();
>       }
>       catch (Exception ex) 
>       { 
>               ex.printStackTrace(); 
>       }
>}
>
>Xml binding file:
><binding>
>  <mapping name="currentJob"
>class="com.jbhunt.rdcc.application.OutboundJob">
>    <value name="jobStatus" field="_jobStatus"/>
>    <value name="jobID" field="_jobID"/>
>    <value name="jobType" field="_jobType"/>
>    <value name="technicianID" field="_technicianID"/>
>    <value name="inventoryLocation" field="_inventoryLocation"
>usage="optional"/>
>    <value name="inspectionRepairLocation"
>field="_inspectionRepairLocation" usage="optional"/>
>    <value name="accountCode" field="_accountCode" usage="optional"/>
>    <value name="jobCode" field="_jobCode" usage="optional"/>
>    <value name="cause" field="_cause" usage="optional"/>
>    <value name="jobPosition" field="_jobPosition" usage="optional"/>
>    <value name="damagePosition" field="_damagePosition"
>usage="optional"/>
>    <value name="damagedArea" field="_damagedArea" usage="optional"/>
>    <value name="correctionCode" field="_correctionCode"
>usage="optional"/>
>    <value name="condition" field="_condition" usage="optional"/>
>    <value name="workPerformed" field="_workPerformed"
>usage="optional"/>
>  </mapping>
></binding>
>
>After compiling with the binding compiler there are no errors.
>However, when I run the following:
>
>OutboundJob myJob = new OutboundJob("new", "EDRInspection", 
>"10234523"); System.out.println("current tech id is " + 
>myJob.getTechnicianID()); myData.writeTempData(myJob);
>
>There is no xml file generated at the specified location.
>
>Thank everyone in advance for the help.
>
>Cheers,
>Damon
>



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise
J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to