Re: [SOLUTION] getting krysalis to work under cocoon

Jeremias Maerki <[email protected]> Thu, 20 Nov 2003 13:33:35 +0100
Newsgroups gmane.comp.krysalis.user
Message-ID <[email protected]>
I've looked up the DOM specs and I found this:
> localName of type DOMString, readonly, introduced in DOM Level 2 
> Returns the local part of the qualified name of this node.
> For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and
> nodes created with a DOM Level 1 method, such as createElement from the
> Document interface, this is always null.

So I guess you're getting a Level 1 DOM and that's why you get null for
getLocalName(). I didn't think of that. But I'm not sure what comes out
if you have a Level 2 DOM with namespaced elements. Probably the code
needs to be:

String cfgname = el.getLocalName();
if (cfgname == null) cfgname = el.getNodeName(); //or getTagName()
DefaultConfiguration cfg = new DefaultConfiguration(el.getLocalName());

Since I'm out of office right I can only check in a few hours. If there
are any DOM-specialists around, their feedback would be appreciated.

I'm glad you found a solution.

On 20.11.2003 12:02:11 Jorg Heymans wrote:
> For anyone else just picking up on this thread, the history of this can 
> be found here 
> http://sourceforge.net/mailarchive/forum.php?thread_id=3492729&forum_id=7972 
> 
> 
> @jeremias
> 
> In the processNode method this bit gets exec'ed.
> 
>          } else if (node.getNodeType() == Node.DOCUMENT_NODE) {
>              return processElement(findDocumentElement((Document)node));
> 
> Now it identifies the <barcode> element as the documentelement allright.
> 
> However in call below
> 
> private static DefaultConfiguration processElement(Element el) {
>   DefaultConfiguration cfg = new DefaultConfiguration(el.getLocalName());
>   ....
> 
> el.getLocalName returns null. I changed this to el.getNodeName and now 
> it works.
> 
> 
> Now who is right here?


Jeremias Maerki



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/