RE: Using Jivan in a Barracuda App - Solved!

David R Robison <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
The problem turned out to be in the HTMLComponentRenderer.java file. When Jivan
parses an HTML file where there is space between the <table> tag and the <tr>
tag, ir inserts a Text node with the blank space. However, HTMLComponentRenderer
changes to ensure that all children of the <table> tag are <tr> tags. If not,
the text is wrapped in a <tr> tag. So it was wrapping blank text in a <tr> tag.
I've modified the HTMLComponentRenderer to fix this.

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
>
HTMLComponentRenderer.java (application/octet-stream, 12.2 KB) - not displayed
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.