xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Clark <an...@apache.org>
Subject Re: problem about parameter entity handling of XNI
Date Thu, 01 Feb 2001 04:40:17 GMT
Libor Kramolis wrote:
> Level 1: *data* oriented
> Level 2: *structure* oriented
> Level 3: *indentation* oriented

Okay, now I feel like we're getting somewhere! :)

> [example] <!ENTITY e1 '&#38;amp;'>
> [1] - level 1 callback
> [2] - level 2 callback
> [3] - level 3 callback
> 
> [2]  startEntityDecl()
> [3]    ignorableWhitespaces (" ")
> [2]    entityName ("e1");
> [3]    ignorableWhitespaces (" ")
> [2]    startEntityValue ('\'')
> [2]      startEntity ("#38")
> [2]        characters ("&")
> [2]      endEntity ("#38")
> [2]      characters ("amp;")
> [2]    endEntityValue ('\'')
> [2]  endEntityDecl()
> [1]  internalEntityDecl ("e1", "&amp;")

Following your lead, how about the following interfaces. Don't
mind the duplicated methods -- they're included for illustrative
purposes so you know what kind of information is received at what
time.

  interface XMLDTDHandler (XNI Core)

    startDTD()

     startEntity(String,String,String,String)
      textDecl(String,String)
     endEntity(String)

     comment(XMLString)
     processingInstruction(String,XMLString)

     elementDecl(String,String)
     attributeDecl(String,String,String,String[],String,XMLString)

     internalEntityDecl(String,XMLString)
     externalEntityDecl(String,String,String)
     unparsedEntityDecl(String,String,String,String)

     notationDecl(String,String,String)

    endDTD()

Note that this simplifies the basic XMLDTDHandler to return only 
the basic information needed to communicate the "data" declared in 
the DTD.

  interface XMLDTD???Handler (XNI extension)

    short CONDITIONAL_INCLUDE
    short CONDITIONAL_IGNORE

    short SEPARATOR_CHOICE
    short SEPARATOR_SEQUENCE

    short OCCURS_ZERO_OR_ONE 
    short OCCURS_ZERO_OR_MORE 
    short OCCURS_ONE_OR_MORE 

    startConditional(short)
     characters(XMLString)
    endConditional()

    startEntity(String,String,String,String)
     textDecl(String,String)
    endEntity(String)

    startEntityDecl()
     entityName(String) // "%e3" would be a parameter entity
     startLiteral(char)
      characters(XMLString)
     endLiteral()
     publicId(char,String) // ??? Not sure about these two
     systemId(char,String)
     ndata(String)
    endEntityDecl()

    startElementDecl()
     elementName(String)
     any()
     empty()
     startGroup()
      pcdata()
      element(String)
      separator(short)
      occurs(short)
     endGroup()
    endElementDecl()

    startAttlistDecl()
     elementName(String)
     attributeName(String)
     // NEEDS TO BE FILLED IN! -- Note, this part is going to
     // large due to the various possibilities
    endAttlistDecl()

    startNotationDecl()
     notationName(String)
    endNotationDecl()

This level of DTD information incorporates many of the non-data 
aspects of XMLDTDHandler and all of the XMLDTDContentModelHandler 
interfaces, in a form changed as to allow the correct callbacks
of start/endEntity.

  interface XMLDTD???Handler (XNI extension)

    whitespace(char[],int,int)
    ignorableWhitespace(char[],int,int) // ???

This interface reports the "indentation" information from the DTD. 
NOTE: I don't believe that this is a reasonable requirement from 
the DTD scanner. But I've included it anyway for the purposes of 
discussion.

Let the discussion begin!

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

Mime
View raw message