Re: Using Jivan in a Barracuda App - Solved!

Arno Schatz <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi David,

great job tracking this down!

-Arno

David R Robison wrote:
> I've isolated the problem. The problem is that when Jivan parses a file where
> there is blank space between the <table> and <tr> tags, it inserts a Text node
> containing the spaces. Then when HTMLComponentRenderer renders the DOM, it
> checks to ensure that only <TR> elements are children of a <TABLE> element. If
> not, then it creates a new <TR> element to enclose the unexpected element. I've
> modified HTMLComponentRenderer to ignore child nodes if they are empty Text
> nodes. I've included the source with this message.
> 
> David Robison
> 
> Quoting Christian Cryder <[email protected]>:
> 
> 
>>Just a comment...
>>
>>Theoretically, Barracuda should work just fine - it doesn't do anything
>>that
>>is XMLC specific (or at least, its not supposed to ;-)...all the
>>interaction
>>with the DOM occurs through the DOM interfaces, so it should be a
>>simple
>>matter to plug in a DOM that was created from a different source.
>>
>>That said, I haven't actually tried Jivan yet, personally, so I can't
>>say
>>for sure what will happen. And unfortunately, I have zero free cycles
>>right
>>now (seems to be the story of my life lately)
>>
>>I have a couple of suggestions.
>>
>>First, I'd try loading the same page entirely with XMLC/BTemplate, and
>>make
>>sure it works there. In other words, get a functional starting point
>>with
>>BTemplate. Typically, when you use BTemplate you won't directly render
>>it
>>yourself - you'll just extend BTemplateViewHandler and let it do the
>>work.
>>
>>Second, once you get that working, then try substituting in a Jivan
>>loaded
>>DOM (without changing anything else). That will tell us for sure if
>>the
>>problem is in BTemplate (or Jivan), rather than in the way you are
>>trying to
>>use it.
>>
>>Third, you may have to dive into BTemplateHandler and the specific
>>component
>>renderers to see exactly what is going on. This may be a bit
>>intimidating,
>>but I think we could help coach you through it if you're willing to get
>>in
>>and do some of the debugging work. My one suggestion if you get to
>>this
>>point is to make you template as simple as you possibly can before
>>trying to
>>debug through BTemplateHandler - that will help keep you from getting
>>more
>>confused than you need be.
>>
>>Let us know how it goes!
>>
>>Christian
>>
>>----------------------------------------------
>>Christian Cryder
>>Internet Architect, ATMReports.com
>>Project Chair, BarracudaMVC - http://barracudamvc.org
>>----------------------------------------------
>>"Coffee? I could quit anytime, just not today"
>>
>>
>>
>>>-----Original Message-----
>>>From: [email protected]
>>>[mailto:[email protected]]On Behalf Of David R
>>
>>Robison
>>
>>>Sent: Wednesday, November 26, 2003 8:23 AM
>>>To: [email protected]
>>>Subject: Re: [Barracuda] Using Jivan in a Barracuda App
>>>
>>>
>>>Thanks for the help...
>>>
>>>The problem definitely is caused when I call templateComp.render(new
>>>DefaultViewContext(context). I was hoping to use Jivan along with
>>>Barracuda's
>>>Template Models. Any idea how I could get them both to work
>>>together in harmony?
>>>
>>>David Robison
>>>
>>>Quoting Arno Schatz <[email protected]>:
>>>
>>>
>>>>David,
>>>>
>>>>Parsing the html you posted has been done with Jivan before, and I
>>>>checked
>>>>it again, the parser parses it correctly. I tried to replicate the
>>
>>DOM
>>
>>>>manipulations which happens is BTemplate and couldn't see any
>>>>problems.
>>>>
>>>>I haven't used BTemplate actually, so I don't know exactly what's
>>
>>going
>>
>>>>on
>>>>in there. But you can print out the DOM before and after BTemplate 
>>
>>is
>>
>>>>being
>>>>called. Can you call org.jivan.html.test.DOMTest.print( doc, "")
>>
>>before
>>
>>>>and
>>>>after BTemplate?
>>>>
>>>>Sorry I can give you a better answer, I haven't used Barracuda
>>
>>myself,
>>
>>>>yet.
>>>>
>>>>-Arno
>>>>
>>>>
>>>>
>>>>>That was a typo on the message... David
>>>>>
>>>>>Christian Cryder wrote:
>>>>>
>>>>>
>>>>>>><table><tr><td>
>>>>>>>BBB
>>>>>>></tr></td></table>
>>>>>>>
>>>>>>>
>>>>>>Not sure if that was a typo or not, but I see an obvious
>>>>
>>>>problem...your
>>>>
>>>>>></tr></td> are in the wrong order. They should be reversed.
>>>>>>
>>>>>>Christian
>>>>>>----------------------------------------------
>>>>>>Christian Cryder
>>>>>>Internet Architect, ATMReports.com
>>>>>>Project Chair, BarracudaMVC - http://barracudamvc.org
>>>>>>----------------------------------------------
>>>>>>"Coffee? I could quit anytime, just not today"
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>-----Original Message-----
>>>>>>>From: [email protected]
>>>>>>>[mailto:[email protected]]On Behalf Of David R
>>>>
>>>>Robison
>>>>
>>>>>>>Sent: Tuesday, November 25, 2003 7:42 AM
>>>>>>>To: [email protected]
>>>>>>>Subject: Re: [Barracuda] Using Jivan in a Barracuda App
>>>>>>>
>>>>>>>
>>>>>>>The JivanDOMWriter did NOT fix the problem. I now believe that
>>>>>>>the problem might
>>>>>>>lie somewhere in the Jivan parser. It appears to be very
>>>>>>>sensitive to how the
>>>>>>>text file is layed out. For example, the following code
>>
>>renders
>>
>>>>>correctly:
>>>>>
>>>>>>><table><tr><td>
>>>>>>>BBB
>>>>>>></tr></td></table>
>>>>>>>
>>>>>>>however, if there is line breaks and space between the
>>
>>elements
>>
>>>>such
>>>>
>>>>>as...
>>>>>
>>>>>>><table>
>>>>>>>  <tr>
>>>>>>>     <td>
>>>>>>>      BB
>>>>>>>     </td>
>>>>>>>  </tr>
>>>>>>></table>
>>>>>>>
>>>>>>>then it likes to insert empty <tr></tr> and <td></td> blocks.
>>>>>>>
>>>>>>>David Robison
>>>>>>>
>>>>>>>
>>>>
>>>>--
>>>>NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
>>>>Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService
>>>>
>>>>Jetzt kostenlos anmelden unter http://www.gmx.net
>>>>
>>>>+++ GMX - die erste Adresse für Mail, Message, More! +++
>>>>
>>>>_______________________________________________
>>>>Barracuda mailing list
>>>>[email protected]
>>>>http://barracudamvc.org/lists/listinfo/barracuda
>>>>
>>>
>>>_______________________________________________
>>>Barracuda mailing list
>>>[email protected]
>>>http://barracudamvc.org/lists/listinfo/barracuda
>>
>>_______________________________________________
>>Barracuda mailing list
>>[email protected]
>>http://barracudamvc.org/lists/listinfo/barracuda
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.