In XML, how do I declare array of integers?
I can declare it as the following:
<numbers type="array">
<value>3</value>
<value>2</value>
<value>1</value>
</numbers>
but may be there’s simpler way like this?
<numbers [3,2,1]></numbers>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The second way isn’t valid XML; did you mean
<numbers>[3,2,1]</numbers>?If so, then the first one is preferred because all you need to get the array elements is some XML manipulation. On the second one you first need to get the value of the <numbers> element via XML manipulation, then somehow parse the
[3,2,1]text using something else.Or if you really want some compact format, you can consider using JSON (which “natively” supports arrays). But that depends on your application requirements.