You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Th...@bgs-ag.de on 2001/05/23 09:32:23 UTC

setAttribute in DocumentBuilderFactoryImpl.java

Hi,
what do you think about mapping of setAttribute in javax.xml.parsers
.DocumentBuilderFactory to
setFeature and setProperty in org.apache.xerces.parsers.DOMParser and then
try to add methods
for doing this to the JAXP Spec if it is necessary?

Then the complete functionalities of xerces can be used through the JAXP
API.

Or do I misunderstand something?

Regards

Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: setAttribute in DocumentBuilderFactoryImpl.java

Posted by Edwin Goei <ed...@sun.com>.
Andy Clark wrote:
> 
> Edwin Goei wrote:
> > The DocumentBuilderFactory#[gs]etAttribute() methods are implementation
> > dependent so you can define them to do whatever you want them to do.
> 
> [snip]
> 
> Anybody want to do this work? If not, I'll do it.

I just checked in some code to implement this into the xerces-j 1.x
repository.  I ran only minimal tests to make sure that old code would
still continue to work.  I'll port the code to xerces 2.x tomorrow.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: setAttribute in DocumentBuilderFactoryImpl.java

Posted by Andy Clark <an...@apache.org>.
Edwin Goei wrote:
> The DocumentBuilderFactory#[gs]etAttribute() methods are implementation
> dependent so you can define them to do whatever you want them to do.

Then I'm in favor of mapping this method to the underlying
get/setFeature/Property methods in the parsers. Shouldn't
be too much work, even with the Object mapping to a boolean:

  if (value instanceof Boolean) {
     parser.setFeature(name, ((Boolean)value).booleanValue());
  }
  else {
     parser.setProperty(name, value);
  }

It isn't *that* easy, though, because the attribute methods
are on the factory and not on the parser instance interface.
But I still think it's not too bad.

> However, I think we should try to avoid possible "name" argument clashes
> with other implementations, which should easily be possible.

This isn't really a problem, I think, because the JAXP
spec suggests using Java package/class naming for new
attributes which are completely different from the URIs
used by the rest of the world. (Can't seem to find the
text at the moment but I remember reading it.)

Anybody want to do this work? If not, I'll do it.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: setAttribute in DocumentBuilderFactoryImpl.java

Posted by Edwin Goei <ed...@sun.com>.
Andy Clark wrote:
> 
> Thomas2.Maesing@bgs-ag.de wrote:
> > what do you think about mapping of setAttribute in javax.xml.parsers
> > .DocumentBuilderFactory to
> > setFeature and setProperty in org.apache.xerces.parsers.DOMParser and then
> 
> I asked Edwin Goei (of Sun) about this and he's getting a
> ruling on whether this was the intented behavior for the
> setAttribute method in the API.

The DocumentBuilderFactory#[gs]etAttribute() methods are implementation
dependent so you can define them to do whatever you want them to do. 
However, I think we should try to avoid possible "name" argument clashes
with other implementations, which should easily be possible.

So the setAttribute() method takes an Object as a value similar to
DOMParser#setProperty().  So the setAttribute() can be directly mapped
to setProperty.  There needs to be some additional processing done to
map DOMParser#setFeature() though if we wanted to expose this.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: setAttribute in DocumentBuilderFactoryImpl.java

Posted by Andy Clark <an...@apache.org>.
Thomas2.Maesing@bgs-ag.de wrote:
> what do you think about mapping of setAttribute in javax.xml.parsers
> .DocumentBuilderFactory to
> setFeature and setProperty in org.apache.xerces.parsers.DOMParser and then

I asked Edwin Goei (of Sun) about this and he's getting a
ruling on whether this was the intented behavior for the
setAttribute method in the API.

> try to add methods
> for doing this to the JAXP Spec if it is necessary?

I personally think they should have just borrowed the
set/getFeature/Property methods from SAX2's XMLReader. Oh
well...

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org