Problem with length attribute included for array elements

View: New views
2 Messages — Rating Filter:   Alert me  

Problem with length attribute included for array elements

by Vijay Kachhawal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello Support Team,
 
My application need to handle the XML file reading generated from .NET as well as Java platform. The XML file is uniform for both the platforms.
 
I developed a java file for performing the reading and writing XML file using java. My java file is having 2 array elements. When I wrote the java object to XML file, I observed that "lenth" attribute is automatically included for the array elements. I am able to read this file correctly using java. But when I tried to read a ".NET" generated xml file using my same java program, I am getting "ArrayIndexOutOfBoundsException". When reviewed the code, found that "length" attribute is missing for array elements. When I explicitly added this attribute for the corresponding elements. the problem was solved. The same problem I also encountered when I deleted the "length" attribute from java generated xml file.
 
So can anybody help me out how to resolve this issue? I need to read the .NET generated XML file without making any explicit changes i.e. without adding "length" attribute for array elements.
 
Thanks in advance.
Regards,
Vijay

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Simple-support mailing list
Simple-support@...
https://lists.sourceforge.net/lists/listinfo/simple-support

Re: Problem with length attribute included for array elements

by niall.gallagher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi,
 
Yes, you have a number of options. One is to remove the length attribute from within the Strategy, the other is to use a list instead of an array. This does not have a length= attribute. Note, without the length attribute you can not deserialize an array properly, it may seem like a usless attribute, but its used to deserialize complex object graphs where the array must exist before the object it references.
 
Niall
 
Niall Gallagher
RBS Global Banking & Markets
Office: +44 7879498724

 


From: Vijay Kachhawal [mailto:vijay.kachhawal@...]
Sent: 19 October 2009 17:03
To: simple-support@...
Subject: [Simple-support] Problem with length attribute included for array elements

Hello Support Team,
 
My application need to handle the XML file reading generated from .NET as well as Java platform. The XML file is uniform for both the platforms.
 
I developed a java file for performing the reading and writing XML file using java. My java file is having 2 array elements. When I wrote the java object to XML file, I observed that "lenth" attribute is automatically included for the array elements. I am able to read this file correctly using java. But when I tried to read a ".NET" generated xml file using my same java program, I am getting "ArrayIndexOutOfBoundsException". When reviewed the code, found that "length" attribute is missing for array elements. When I explicitly added this attribute for the corresponding elements. the problem was solved. The same problem I also encountered when I deleted the "length" attribute from java generated xml file.
 
So can anybody help me out how to resolve this issue? I need to read the .NET generated XML file without making any explicit changes i.e. without adding "length" attribute for array elements.
 
Thanks in advance.
Regards,
Vijay
***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority. 
 
This e-mail message is confidential and for use by the 
addressee only. If the message is received by anyone other 
than the addressee, please return the message to the sender 
by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The 
Royal Bank of Scotland plc does not accept responsibility for 
changes made to this message after it was sent. 

Whilst all reasonable care has been taken to avoid the 
transmission of viruses, it is the responsibility of the recipient to 
ensure that the onward transmission, opening or use of this 
message and any attachments will not adversely affect its 
systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry 
out such virus and other checks as it considers appropriate. 

Visit our website at www.rbs.com

***********************************************************************************

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Simple-support mailing list
Simple-support@...
https://lists.sourceforge.net/lists/listinfo/simple-support