W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2001

Re: C type array and struct

From: Mukund Balasubramanian <mukund@cs.stanford.edu>
Date: Fri, 02 Feb 2001 19:58:58 -0800
Message-ID: <3A7B8202.BAAEE9EB@cs.stanford.edu>
To: Xin Ye <xinye98@yahoo.com>, Schema-dev <xmlschema-dev@w3.org>
    I think you are confusing a class with an XML object instance. You
do not index the type specification. When you DO get an instanceof the
type, the document that you have DOES give you an ordered list. Of
course, it depends on the object model you are using to access the data,
but EVEN if you are using a simple XML DOM, you have an ORDERED list of
children, not an undordered list.
   For example, in the HTML DOM, using the HTMLCOllection is equivalent
to using an array, (HTMLCollection.item(i) == arr[i]). And in
Javascript, the wrapper around the HTMLCollection allows you to do a
document.forms[i];

Does that help?

Mukund Balasubramanian


Xin Ye wrote:

> but how can we get the functionality of using
> subscription like refer to some element in the array
> like arr[i]? I think XML lacks the functionality for
> simulating arrays since it can not provide an indexing
> system. What you provide seems to me like only a list
> not an array. Maybe I was wrong.
>
> --- Mukund Balasubramanian <mukund@cs.stanford.edu>
> wrote:
> > Hi,
> >     I presume that is what you get when you define
> > an element with maxOccurs
> > > 1. For example:
> >
> > <xsd:complexType name="MyClass">
> >     <xsd:sequence>
> >         <xsd:element name="arr" type="MyElement"
> > maxOccurs="unbounded"/>
> >     <xsd:sequence>
> > </xsd:complexType>
> >
> > is equivalent to (simplistically):
> >
> > class MyClass {
> >     MyElement[] arr;
> > }
> >
> > Hope that makes things clear...
> >
> > ThanX,
> >
> > Mukund Balasubramanian
> >
> >
> > Ayalew Kassahun wrote:
> >
> > > hi,
> > >
> > > How can define C like array (all subelements
> > should be of same type) with
> > > XML Schema?
> > >
> > > thanks in advance,
> > > Ayalew
> >
>
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
Received on Friday, 2 February 2001 22:58:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:50 UTC