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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   SAX2 Lexical Handler Suggestions

[ Lists Home | Date Index | Thread Index ]
  • From: Chris Pratt <chris@planetpratt.com>
  • To: XML Development Interest Group <xml-dev@lists.xml.org>
  • Date: Tue, 11 Jul 2000 10:47:19 -0700

In trying to design a system that uses XML to implement a Dynamic Web Site,
I ran into a few problems that the current crop of SAX2 Handler couldn't
handle.  And since the SAX2 Extensions are still in the beta stage, I wanted
to make my suggestions for improvement now before the concrete hardens.
First of all, what is the utility of the startEntity() and endEntity()
methods of the LexicalHandler?  The end of the entity has definitely been
parsed before the call to startEntity since the name of the entity is a
parameter.  And since a single entity can't bracket information (like an
element does) there is no utility in the endEntity() method, unless I'm
missing something obvious.  In this case, I would suggest we rename the
startEntity() method to simply entity() and remove the endEntity() method.

Also many systems (mine included) need to be able to tell the difference
between an entity in element data and an entity as an attribute value, so
I'd suggest adding a boolean parameter to the entity() method specifying
which of the two possible uses of entities has been found (i.e. public void
entity (String name,boolean isAttr);).

My final suggestion is a method to detect when attributes are encountered
being that there is a great amount of information that can be disseminated
in an attribute definition.  My current hack of the AElfred parser defines a
SAX2 Extension handler that supports the following call:

  /**
   * An attribute has been encountered
   *
   * @param element The Element Name
   * @param namespace The XML Namespace URI
   * @param name The Attribute's Local Name
   * @param qName The Attribute's Qualified Name
   * @param value The Processed Attribute Value
   * @param text The Raw Attribute Value
   * @param isSpecified true if the value was specified in the document,
   *                    false if this is a default value
   * @exception SAXException A SAX Exception
   */
  void attribute(String element,String namespace,String name,String
qName,String value,String text,boolean isSpecified) throws SAXException;

Thanks for listening, err reading.
    (*Chris*)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS