OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SAX-ext Attribute + Entity Parsing



Justin,

Justin Couch wrote:

<.../...> 
> This is what I want to do:
> 
> To create a class that represents both the SAI field interface and the
> DOM attribute I need to provide some mapping service between the name
> and
> the class type. To do this, I've registered myself as a SAX2
> DeclHandler. In this, I have two methods:
> 
>     public void attributeDecl(String element,
>                               String name,
>                               String type,
>                               String defValue,
>                               String value)
> 
Instead of adding methods to the SAX2 classes, have you considered using
the existing ones to pass additional elements/attributes from a specific
namespace to the applications using the existing ones ?

In this case, you would use instead a startElement with a namespaceURI
set to this namespace, a localName set to "attributeDecl" and attributes
containing the name, type, defValue and value.

The applications would then see this as an element:

<xxx:attributeDecl name="..." type="..." defValue="..." value="..."/>

The main benefit from this method is that the additional information
gathered from your documents are passed to the applications using a
common and "standard" API and that you don't need to modify the layer
between these applications and the SAX parser to get them.

For instance, you can directly apply a XSLT transformation on your
documents using this parser and access to the attribute declaration with
XPath. 

I have described a similar application in August last year:
http://www.xml.com/pub/a/2000/08/09/xslt/xslt.html

Hope this helps.

Eric
> --
> Justin Couch                                    Author, Java Hacker
> http://www.vlc.com.au/~justin/               Java 3D FAQ Maintainer
> http://www.j3d.org/              J3D.org The Java 3D Community Site
> -------------------------------------------------------------------
> "Humanism is dead. Animals think, feel; so do machines now.
> Neither man nor woman is the measure of all things. Every organism
> processes data according to its domain, its environment; you, with
> all your brains, would be useless in a mouse's universe..."
>                                               - Greg Bear, Slant
> -------------------------------------------------------------------
> 
-- 
See you in Austin (Knowledge Technologies 2001)
              http://www.gca.org/attend/2001_conferences/kt_2001/mon.htm
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------