Maybe this is more a posting for the developer forum, becauses it addresses some rather technical issues while working with the DTDGrammar class.

While working to improve the support for DTD editing in my xml editor, I came across some issues with the DTDGrammar class.

1. It would be very nice to be able to get the ContentSpecIndex for an element. I tried to workaround this with the following code in my own program:
int chunk = elementDeclIndex >> CHUNK_SHIFT;
int index = elementDeclIndex & CHUNK_MASK;
int contentSpecIndex = grammar.fElementDeclContentSpecIndex[chunk][index];


But to get this working I had to change the private identifier of fElementDeclContentSpecIndex in DTDGrammar to public.
So a public function getElementContentSpecIndex (int elementDeclIndex) would be very nice.
This way you can get the first "contentModel particle", and from there work up to the containging particles (like the method getContentSpecAsString in DTDGrammar does).
By the way I saw that this issue was already posted long time ago in XERCESJ-618

2. In DTDGrammar there is a function getElementDeclIndex(elementName) to get the index of the ElementDeclaration.
But it looks like this does not always work. Maybe the String object of the elementName must be exact the same object as stored in the DTDGramar class ???. I had to program a workaround by just looping through all the elementDeclarions (by means of method grammar.getNextElementDeclIndex(i))

Regards
Dick Deneer


Reply via email to