How to ??
Bill la Forge
b.laforge at jxml.com
Wed Mar 17 18:04:21 GMT 1999
>If so, my reading is that those are deviations from the DOM Recommendation -- in
>other words, bugs.
Frankly, I think the problem is more with the fact that they are SAX-based.
Complicating matters is the lack of a method for setSpecified (DOM is somewhat
incomplete from the perspective of an application) and a particular DOM implementation
which uses a private variable for the specified variable. (I haven't looked at the
JavaSoft implementation yet. This was true for just one DOM implementation.)
But subclassing was still viable. We just had to define a second specified variable
and override the isSpecified method to use it. This will all be included in the upcoming
(and still open source) production release of MDSAX.
Adding specified to SAX is really pretty simple--no changes to any interfaces is needed.
Its just a matter of subclassing the existing AttributeList interface in either the parser or
a filter which has access to default values. The DOM builder then can check for the use
of this extended interface to access the specified value.
I've appended the AttributeList and Attribute interfaces to this email. This is what we're
working with now, though your input would be welcome. In my mind, including these
interfaces (or something similar) in ModSAX/OpenSAX/SAX2 would be the best of all
worlds.
Bill
public interface MDAttributeList extends AttributeList
{
/*
* Make this attribute list a copy of another
*/
public void
copy(AttributeList attList);
/*
* Get an attribute object (by name)
*/
public MDAttribute
getMDAttribute(String name);
/*
* Get an attribute object (by position)
*/
public MDAttribute
getMDAttribute(int i);
/*
* Add an attribute
*/
public void
putMDAttribute(MDAttribute att);
/*
* Remove all attributes
*/
public void
clear();
/*
* Remove an attribute
*/
public void
removeMDAttribute(MDAttribute att);
/*
* Remove an attribute by name
*/
public void
removeMDAttribute(String name);
/*
* Remove an attribute by position
*/
public void
removeMDAttribute(int i);
/**
* Returns the specified property for the ith attribute.
*/
public boolean getSpecified(int i);
/**
* Returns the specified property for the named attribute.
*/
public boolean getSpecified(String name);
}
public interface MDAttribute
{
/*
* Make this attribute list another, except
* that the name of the attribute is not changed.
*/
public void
copy(MDAttribute att);
public String
getName();
public String
getType();
public void
setType(String type);
public String
getValue();
public void
setValue(String value);
public boolean
getSpecified();
public void
setSpecified(boolean specified);
}
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list