From: "Mike Skells (ebizz-consulting)" <[EMAIL PROTECTED]>
> HI James,
> I'm not sure that I understand the problem that you are describing related
> to the Xincludes
> Are you talking about a specific implementation of Element, or some Xpath
> description.

I was taking XIncludes to be an example of a specific qualified name of
Element that we may want to treat differently, using its own factory. i.e.
we want to process a certain 'type' of element with a certain factory, but
process its children in the same way as its parents. If an Element were to
always delegate to its parent to get the factory, this kinda thing would
break.

Another example could be validation. Imagine if we attach some validation
rule to an Element (like in the data type stuff) via a factory. So for
<order> there must be a product child. However just because the <order>
element contains other elements, it doesn't mean we want to force all
children of <order> to use the order's factory.

For any schema-based models I think defaulting to the document's factory is
cleaner than defaulting to the parents element.


> If you mean the former then this can be handled by the overriding the
> methods
> Are you concerned about the difference between the documentFactory of the
> element, and the document factory of the node to be created below it, if
so
> that this is an issue for the document factory itself
> I feel that I am missing the point soo please can you explain the issue
more
> fully.
>
> Regarding the setDocumentFactory method that I was talking about, I was
> referin to the method in the Qname class dot he document class. I think
that
> having the ability to change the DocumentFactory of a QNAme is dangerous
>
> Consider this
> Documentactory df1,df2 ;
> Element e1;
> Namespace ns1
> ...
> //e1 created via documentFactory df1
> e2 = e1.addElement("x");
> e3 = e1.addElement("x");
> e4 = e1.addElement("y");
> e2.getQname().setDocumentFactory(df2);
>
> now e3.getDocumentFactory() != e4.getDocumentFactory();
>
> the problem is the immutability of the shared QName

Yes this is a concern. Though the ability to customize the factory on a per
QName basis is very powerful, e.g. schema or datatype aware processing or
SOAP handling, JAXM etc.

Though you're right, this immutability could cause problems, though I'm not
sure how to get around it.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Reply via email to