#18 parser for "children" content models

open
nobody
5
2014-08-17
2002-02-26
Anonymous
No

Hello,

currently, the DeclHandler for DTD element declarations
looks like this:

public void elementDecl(String name, String contentModel)

where name is the element name, and content model can
be one of 'EMPTY' 'ANY' or a parenthesized (and
possibly nested) list of allowable children and an
instance number indicator.

it would be nice if in the last case a different method
were called, that looked something like this:

public void elementDeclChildren( String name, Group
children)

where Group might look somehting like

class Group {

// constants used
// for child_count

public static int ONE_OR_MORE = 0;
public static int ZERO_OR_MORE = 1;
public static int ZERO_OR_ONE = 2;
public static int EXACTLY_ONE = 3;

Group(){

}

// allowalbe child names
// at this level

protected Vector childNames;

// any nested groups occuring
// at this level

protected Vector nestedGroups;

// the child count
// for this group

protected int child_count;

/* accessor methods */

...

}
the point being that anyone interested in the
contentModel when its a child list is going to have to
parse the information in order to use it. Rather than
have everyone write their own parsers, it would be nice
if this one could be extended to do this for us.

thanks for listening ^^
marco

Discussion

  • David Brownell
    David Brownell
    2002-03-05

    Logged In: YES
    user_id=44117

    Well, DeclHandler is not going to change, since
    that interface is frozen.

    However, I could see some utility to providing a
    class that knows how to parse "children" content
    models. Particularly if it could easily work with
    some implementation of a validator.

    Parsing mixed content is much simpler though;
    easy to do with a StringTokenizer.

    Feel free to attach a file to this RFE with public
    domain source for such a parsing utility class.

     
  • David Brownell
    David Brownell
    2002-03-05

    • summary: some suggestions for DeclHandler --> parser for "children" content models
     
  • David Brownell
    David Brownell
    2002-05-25

    • summary: parser for "children" content models --> parser for "children" content models
     
  • David Brownell
    David Brownell
    2002-05-25

    Logged In: YES
    user_id=44117

    This would probably be better in a utility layered on top of
    SAX.
    Such code does exist (e.g. under LGPL).

    If nobody provides code for such a parser, and puts it into the
    public domain, I'll close this RFE as not belonging in SAX.