xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mandy.s...@uk.catalyst-solutions.com
Subject Re: getting a list of valid elements
Date Fri, 26 Jan 2001 09:12:50 GMT
I have been down this route too, with zero success (in fact I posted a
question on this list & got no responses at all). It seems quite
extraordinary, and very irritating, that you cannot obtain this information
through DOM when it's all there in the DTD. Of course you can read the DTD
line by line & parse it yourself, but I worked around it another way in my
application.
If you get any joy, please keep me posted - would appreciate it a lot.
Mandy





Patrick Lightbody <plightbo@cisco.com> on 26/01/2001 01:25:25

Please respond to general@xml.apache.org

To:   general@xml.apache.org
cc:    (bcc: Mandy Shaw/Pacific/UK)
Subject:  getting a list of valid elements




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:
<foo>
<bar item="1">#PCDATA</bar>
<bar item="2">#PCDATA</bar>
<bar item="3">#PCDATA</bar>
...
<bar item="n">#PCDATA</bar>
</foo>

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.

-Pat


---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org




      Regards,
      Mandy Shaw

      Catalyst Solutions plc
      Kingfisher House
      Frimley Business Park
      Camberley
      Surrey
      GU16 5SG
      UK

      http://www.catalyst-solutions.com
      Email: Mandy.Shaw@uk.catalyst-solutions.com

      Telephone: +44 (0)870 166 1000
      DDI: +44 870 166 1324
      Facsimile: +44 870 168 3920
      Mobile: +44 410 447966






----------------------------------------------------------------------
Catalyst Solutions plc.  Registered No 2918101.
Registered @ Kingfisher House, Frimley Business Park, Frimley,
Surrey. GU16 5SG   U.K.

NOTICE:
This message is intended only for the named addressee(s) and may
contain confidential and/or privileged information. If you are not the
named addressee you should not disseminate, copy or take any action
or place any reliance on it. If you have received this message in error
please notify postmaster@catalyst-solutions.com and delete the message
and any attachments accompanying it immediately.
----------------------------------------------------------------------



Mime
View raw message