SAX2: Namespace proposal

Clark C. Evans clark.evans at manhattanproject.com
Sun Dec 19 17:33:22 GMT 1999


This looks very similar to what Ray had 
proposed a few days ago. 

On Sun, 19 Dec 1999, James Clark wrote:
> No.  I need to be able to build a tree that includes the all the
> namespace scoping information.  Something like:
> 
> interface NamespaceDeclHandler {
>   void startNamespaceDecl(String prefix, String namespace);
>   void endNamespaceDecl();
> }
> 
> with calls to start/endNamespaceDecl outside the calls to the
> corresponding start/endElement would do it.

In this case, perhaps leave startElement alone:

  void startElement(String name, AttributeList atts);

This is more in the spirit with SAX, a low-level simple
interface; where the application programmer has to 
do much of the work.  To make things easy for the
application programmer:

package org.sax.helper;

class NamespaceDeclHandlerImpl implements NnamespaceDeclHandler 
{
  Stack stack;
  private class Pair { 
    String prefix; 
    String namespace; 
    public void Pair(String prefix, String namespace) {
      this.prefix=prefix; this.namespace=namespace;
    }
  };
  public void NamespaceDeclHandlerImpl() {
    stack = new Stack(); 
  }          
  void startNamespaceDecl(String prefix, String namespace) {
     stack.push(new Pair(prefix,namespace));
  }
  void endNamespaceDecl() {
     stack.pop();
  }
  String getNamespace(String name) {
    return namespaceFoundBySearchingStack;
  }
}




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 unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe 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