You are going to have to explain to me what you mean by "element types" exactly.
I think you may be confused by our use of "document type". Here's what it means: Each time you have a global element declaration in Schema, say <element name="Compilance"... XmlBeans adds a "document type" which is a complex type containing just one element: "Compliance". These "document types" are not an XMLSchema concept, we added them because it made certain operations easier. It's up to you if you want to use them or not. My guess is that it is one of these document types you are querying and this is why you get an array of SchemaProperties of length 1. Try getting the type of that property, get its SchemaProperties and most likely you will find the array you expect, of length 2. Radu On Tue, 2007-04-03 at 15:39 -0700, Vance Vagell wrote: > Hi Radu, > > Thanks for the reply. I admit that I may very well be misinterpreting the > Javadocs in terms of what SchemaType covers. > > Here is my overall goal: > > - Given a set of schemas, generate a set of element types. Then, whenever an > element type is retrieved from this set (my code manages that retrieval > mechanism), be able to determine all child element types/attribute types (and > recurse through those as necessary to fully defined the structure of the > element type). > > To do this today, I'm using XmlBeans.compileXsd(), and taking all of the > SchemaTypes (via typeSystem.documentTypes(), typeSystem.attributeTypes(), and > typeSystem.globalTypes()) out of the resultant SchemaTypeSystem and putting > them into an ArrayList. Then I can search through that ArrayList for > whatever element type I'm interested in. However, once I retrieve the > SchemaType of interest, I am having difficulty accessing its children > (element types and attribute types). > > My current approach is based loosely on the example in the Javadocs (see > http://xmlbeans.apache.org/docs/2.2.0/reference/index.html) that starts "The > following code is a standard treewalk...". > > The problem I had with Lawrence's post was that when I called getProperties() > on the SchemaType I was interested in, it didn't return an array of the > expected size. From the schema example I provided last time (where the > "Compliance" element type should have two child types), the result from > getProperties() was an array of size 1 (instead of the expected size of 2), > and the one entry didn't seem to have a name (or at least I couldn't retrieve > it via getName(), which gave null). > > I'm sure I'm making a mistake in my approach somewhere, in particular because > you've mentioned that SchemaTypes don't represent elements (I assume you mean > "element types"). Could you please provide some general direction on how I > can approach the problem I'm trying to solve? > > Thanks for the help, > Vance > > > -------- Original Message -------- > > Subject: Re: How can I iterate through children (elements and > > attributes) of a SchemaType? > > From: Radu Preotiuc-Pietro <[EMAIL PROTECTED]> > > Date: Tue, April 03, 2007 6:10 pm > > To: [email protected] > > > > Hi Vance, > > > > I would be interested in what part of what Lawrence had said in that > > post you had trouble with. > > > > I am also afraid that you may be making a slight confusion between > > elements and types when you say "i.e. SchemaTypes representing those > > children[elements]" Elements and types are distinct entities in > > XMLSchema and even though each element has a type, you can have multiple > > elements with the same type; therefore, SchemaTypes don't represent > > elements. > > > > Radu > > > > On Tue, 2007-04-03 at 10:45 -0700, Vance Vagell wrote: > > > Hi folks, > > > > > > I've been struggling with this issue for the past couple days, and > > could use any guidance you can provide. I have a set of schemas > > that have been compiled (using XmlBeans.compileXsd()) into an array > > of SchemaTypes. When I am working with one of those SchemaTypes I > > need the ability to find out: > > > > > > 1) What valid child elements of this type are (i.e., SchemaTypes > > representing those children) > > > 2) What valid attributes of this type are (i.e., SchemaTypes > > representing those attributes) > > > > > > For example, I have a reference to a SchemaType that contains the > > definition of (namespace references removed for simplicity): > > > > > > ... > > > > > > > > > > > > > > > > > > > > > > > > > > > ... > > > > > > I am able to retrieve it's name fine, but I cannot find a way to > > retrieve the SchemaType objects representing its two children, > > "Company" and "confidence". I've tried numerous suggestions I was > > able to find online, the most promising of which was: > > > > > > > > > But that approach did not result in an array of two SchemaTypes as > > expected. I always reviewed all XmlBeans tutorials, but did not > > find any examples of this type of deep processing on SchemaType > > objects. Additionally, the Javadocs are fairly vague for many > > SchemaType methods, unfortunately. > > > > > > In general (not just with this example), given a SchemaType, how can > > one find all of its children SchemaTypes? > > > > > > Thanks, > > > Vance > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > Notice: This email message, together with any attachments, may > > contain information of BEA Systems, Inc., its subsidiaries and > > affiliated entities, that may be confidential, proprietary, > > copyrighted and/or legally privileged, and is intended solely for the > > use of the individual or entity named in this message. If you are not > > the intended recipient, and have received this message in error, > > please immediately return this by email and then delete it. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

