You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Chris Halverson <ch...@ncube.com> on 2000/06/02 19:32:05 UTC

RE: Walking the DTD

Your stuff works fine but I still only get Elements have you come up with a
reason why
we don't get anything?  I even built using todays source.

> -----Original Message-----
> From:	Håvard Wigtil [SMTP:havardw@stud.ntnu.no]
> Sent:	Sunday, May 28, 2000 2:02 PM
> To:	xerces-j-dev@xml.apache.org
> Subject:	Re: Walking the DTD
> 
> On Fri, 26 May 2000, Chris Halverson wrote:
> 
> > I actually asked this one a couple of times before and was the list was
> > resoundingly silent.
> > 
> > There appear to be classes and methods to access the DTD for a document
> > object much 
> > like a the document itself.  It also states on the Xerces website that
> this
> > is an available feature.
> >  however can't seem to get them to work.  Anyone out there have any
> > perspective?  
> > Any comments?  Any hope? 
> 
> I found the info on this on the "Features" page,
> http://xml.apache.org/xerces-j/features.html
> 
> First you need to enable the "grammar-access" featur, thus:
> 
> 
>   DOMParser parser = new DOMParser();
> 
>   parser.setFeature("http://apache.org/xml/features/domx/grammar-access",
>                      true);
> 
> 
> 
> You will the be able to access the DTD information as a Schema tree, this
> tree is the only child node of the Doctype element.
> 
> Try something like this:
> 
>   Node dtd = document.getDoctype().getFirstChild();
> 
> 
> "dtd" will now contain a tree repesentation of the DTD.
> 
> I got this far, my problem is that (using Xerces 1.0.4) the elements
> donesn't have any spesific names, only general names like "element".
> 
> I haven't really looked into this yet, I've just started playing with
> Xerces. But if you find a way to extract the propper name of the element,
> please let me know.
> 
> 
> Try this link for my small test:
> 
>    http://www.stud.ntnu.no/~havardw/XMLText.java
> 
>     Håvard
> 
> mailto:havardw@stud.ntnu.no||http://www.stud.ntnu.no/~havardw||phone:93846
> 468
>  All it takes to start an avalanche is a single snowflake||Or a
> snowboarder
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

RE: Walking the DTD

Posted by Håvard Wigtil <ha...@stud.ntnu.no>.
On Fri, 2 Jun 2000, Chris Halverson wrote:

> Your stuff works fine but I still only get Elements have you come up with a
> reason why
> we don't get anything?  I even built using todays source.

I haven't had time to look into it yet. (I am, as a side note, trying to
implement the javax.swing.text.Document interface as a DOM tree, and
having a hard time at it.) But I'm guessing that there may be two reasons:

 1) It's not properly implemetet yet, I'm guessing that odd release
    numbers means it's unstable.
 2) The DTD is said to be returned as a Schema tree, perhaps schemas need
    to be treated differently.


    Håvard

mailto:havardw@stud.ntnu.no||http://www.stud.ntnu.no/~havardw||phone:93846468
 All it takes to start an avalanche is a single snowflake||Or a snowboarder