xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas B. Passin" <tpas...@mitretek.org>
Subject Re: getting a list of valid elements
Date Fri, 26 Jan 2001 22:21:56 GMT
xmlproc, a python parser, lets you get at the dtd information.  It's at

http://www.garshol.priv.no/download/software/xmlproc/

Being python, I'm pretty sure it would work using JPython with java. You
can use it to parse just the dtd, then you could use Xerces or whatever
to parse the bulk of the document.  Or, use only the dtd info while
authoring.  The dtd interface can give you content model and a list of
the elements for any element, which is probably what you want.


<mandy.shaw@uk.catalyst-solutions.com> wrote -

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



Mime
View raw message