#18 parser for "children" content models



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

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;



// 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 ^^


  • Anonymous - 2002-03-05

    Logged In: YES

    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.

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

    Logged In: YES

    This would probably be better in a utility layered on top of
    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.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks