[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-dev
Subject:    On-the-fly validation question
From:       Jessica Perry Hekman <jphekman () arborius ! net>
Date:       2000-09-29 19:17:55
[Download RAW message or body]

(Using Xerces-J 1.2.0.)

The goal: I receive a Document (created by DOMParser) which isn't valid. I
happen to know the names of the elements which should be renamed; once
they are renamed, the Document will be valid. (It's a slightly weird goal,
but there you are.) I have called Document.getElementsByTagName() to get a
NodeList of the offending elements. I need to find out what elements
*could* be in those elements' places, in order to make the Document valid.

The whatCanGoHere() method seems to be what I want. However:

* XMLValidator.whatCanGoHere() is protected. I tried subclassing
XMLValidator. It seemed like a kludgey solution, and in fact turned out
not to be any kind of solution: XMLValidator is final.

* There are various XMLContentModel subclasses with public whatCanGoHere()
methods. Now, I'd really rather call the XMLValidator version, because it
does nice error checking and gets the XMLContentModel subclass for me. But
I'm willing to do that myself. How do I get the XMLContentModel subclass
for this element, you ask? Good question.
XMLValidator.getElementContentModel() is private. I could ask the
GrammarResolver for its Grammar object, which would tell me the content
model I need for this object, but XMLValidator has its GrammarResolver in
a private field (you can call a public method to set it, but there is no
corresponding method to get it), so I can't go that route, either.

I can't see how to call any version of whatCanGoHere(), even though its
documentation suggests that it's targeted at end users, not internal
Xerces developers. I hope that I'm missing something and that you nice
folks can tell me what. Alternatively, is there an API bug? I know this
API isn't really complete yet (right?). Could I request that
XMLContentModel.whatCanGoHere() be made public? (Although that wouldn't
solve my problem in time to meet my deadline, I suspect.)

Thanks for any help you can give.

Jessica


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic