Yes, this is the approach that I'd use, too.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Varghese C V wrote:
> I think this is a good idea.
>
> cheers
> Varghese C V
>
> netb0y wrote:
>   
>> The solution I've come up with is to subclass Reader to patch my invalid xml 
>> files. I create a mapping for <data_list> (even though my files only contain 
>> <data> elements) and when unmarshalling I pass an instance of the following 
>> DataReader class to unmarshallDocument(). Is this is a good or bad idea? 
>>
>> import java.io.Reader;
>> import java.io.InputStreamReader;
>> import java.io.IOException;
>> import java.io.StringReader;
>>
>> public class DataReader extends Reader {
>>     private final StringReader START_READER = new 
>> StringReader("<data_list>");
>>     private final StringReader END_READER = new StringReader("</data_list>");
>>     private InputStreamReader isr;
>>
>>     public TrackingDataReader(InputStreamReader isr) {
>>         this.isr = isr;
>>     }
>>
>>     public int read(char[] cbuf, int off, int len) throws IOException {
>>         int retval = START_READER.read(cbuf, off, len);
>>         if (retval == -1) {
>>             retval = isr.read(cbuf, off, len);
>>         }
>>         if (retval == -1) {
>>             retval = END_READER.read(cbuf, off, len);
>>         }
>>         return retval;
>>     }
>>
>>     public void close() throws IOException {
>>     }
>> }
>>
>>
>> ----- Original Message ----
>> From: netb0y <[EMAIL PROTECTED]>
>> To: jibxusers <jibx-users@lists.sourceforge.net>
>> Sent: Saturday, April 7, 2007 1:13:53 AM
>> Subject: [jibx-users] No Root Element
>>
>>
>> I am working with xml files that do not have a root element. Basically I 
>> have files that look like the following:
>>
>> ----------------start-file----------------
>> <data>
>>
>>     <something></something>
>>
>> </data>
>> <data>
>>
>>     <something></something>
>>
>> </data>
>> <data>
>>
>>     <something></something>
>>
>> </data>
>>
>> -----------------end-file-----------------
>>
>> I've been trying to unmarshall all the <data> objects from this type of file 
>> but have not figured out how to do it. Is it possibly to unmarshall a file 
>> like this? The unmarshallDocument(reader) method successfully returns the 
>> first <data> object within the file. How can I get the rest of the <data> 
>> objects?
>>
>> Thanks,
>> Chris
>>
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________
>> Need Mail bonding?
>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>> http://answers.yahoo.com/dir/?link=list&sid=396546091
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>
>>
>>  
>> ____________________________________________________________________________________
>> Now that's room service!  Choose from over 150,000 hotels
>> in 45,000 destinations on Yahoo! Travel to find your fit.
>> http://farechase.yahoo.com/promo-generic-14795097
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> jibx-users mailing list
>> jibx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>
>>   
>>     
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to