[jdom-interest] How to [easily] deal with optional children?

Jehoiada Bernard jbernard at rochester.rr.com
Tue Sep 12 09:13:04 PDT 2000


Givent the following element declaration:
    <!ELEMENT Request (JobCreationRequest | JobModificationRequest | JobEstimationRequest | JobControlRequest | ServiceControlRequest)?>

A Request element can have one of the listed children. Is there a way to get the child element without attempting getChild("JobCreationRequest") then if that fails try getChild("JobModificationRequest") an so on.

What I really want to do is get the first (only) child of the Request element then use element.getName() to determine which one actually appears in the document.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20000912/422e3987/attachment.htm

More information about the jdom-interest mailing list