I can answer the 'why lookup by name' issue. When constructing schema via API, rather than by having parsed XML, you have to lookup by name to get the references to store in the first place.
> -----Original Message----- > From: Glen Daniels [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 31, 2007 8:19 AM > To: [email protected] > Subject: Re: [XmlSchema] [Vote] Time for a release - take 2 > > Hi Amila: > > Amila Suriarachchi wrote: > > On 10/30/07, Glen Daniels <[EMAIL PROTECTED]> wrote: > >> So, what I'd like to do is: > >> > >> * (best solution) Fix the problem with the API, and don't bother > >> providing an option for "local" searches... why would you want/need > such > >> a thing? (if someone can provide a solid use-case I'm flexible on this) > >> Fix ADB to use the new code. > > > > I am agree with your argument about the method signature. And also if I > am > > extending it > > ByName part can also omited since there is nothing other than the name > which > > can uniquely identify the Element or type. > > +1, you are totally right, and if I was building from scratch now I'd > just call the methods getElement()/getType(). But since we already have > the API, I'm not sure we should change the name just for that. :) > > > Lets take this senario to explain why ADB needs the parent schema. > > Lets say we have three elements > > E1(S1) refers to E2(S2) (in different schema) > > E2(S2) refers to E3(S3) (in different schema) > > > > What currently ADB does is it > > first find the schema of the E2 (i.e. S2) starting with the > > S1. (since it should be possible to find it serching through imports and > > includes starting from S1) > > Well, hang on a sec. Can you explain to me exactly what it's doing here > (or point me at the code in question)? I would think you'd read in the > schema and then end up walking the elements inside an > XmlSchemaComplexType - which typically means using getItems() on the > contained sequence. To be clear, I'm imagining this: > > <schema targetNamespace="ns1"> > <element name="E1"> > <complexType> > <sequence> > <element ref="ns2:E2"/> > </sequence> > </complexType> > </element> > </schema> > > So my question here is why do you need the actual XmlSchema object at > all for S2? Don't you just end up with an XmlSchemaElement for E2 when > you're walking the structure of E1? > > What I'm really asking is why do you need to look anything (from a > foreign namespace) up by name, when the object model lets you just walk > the objects directly? > > > So you can argue that why E3 can not be found starting with S1 as well? > yes > > this is correct, the only thing it is inefficient since we always have > to > > start search from the bottom. > > therefore I think it is nice to have getElementByName(String) method as > > well. > > +1, seems reasonable. > > Thanks, > --Glen > > > --------------------------------------------------------------------- > 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]
