xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Lightbody <pligh...@cisco.com>
Subject getting a list of valid elements
Date Fri, 26 Jan 2001 01:25:25 GMT
I have explored using Xerces and Oracle's XML parsers to be able to create 
a simple web-based XML editor. Consider this sample use-case:

I have a DTD or XML Schema that defines the grammar as:
<bar item="1">#PCDATA</bar>
<bar item="2">#PCDATA</bar>
<bar item="3">#PCDATA</bar>
<bar item="n">#PCDATA</bar>

I need to present a web-based form for one textfield with input for the 
PCDATA for "bar #1". Since the grammar defines that <foo> must have 1 or 
more <bar> elements. So somehow I need to get my class to "know" that "foo" 
can have one or more "bar" elements. It must also know that "bar" can have 
no child elements, but can have many "bar" siblings. Is this possible? XML 
Spy has helpers in the application that present the "expected elements" 
defined by the XML grammar, yet I can't find any parser that allows for this.

Obviously if a validating parser can throw an Exception if I add an 
*unexpected* element to the tree, it must somehow know which elements are 
*expected*. Is it possible to get that list of expected elements? With this 
"list" of expected child and sibling elements, I could be able to build a 
simple web-bases XML editor that would prompt for data inputs, entirely 
independent of the XML schema/DTD.


View raw message