[opencms-dev] <cms:parse> usage

Christoph P. Kukulies kuku at physik.rwth-aachen.de
Sat Sep 27 09:33:17 CEST 2008


Thanks, Olli, that's fine, that you are showing me how to access the tag
resp. how to overwrite the method.

What I still don't get, where in the workplace or in OpenCms I should
put the code? Should I write a jsp? Should I dig into the OpenCms code?

Cheers,

--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de

On Fri, Sep 26, 2008 at 11:21:24PM +0100, Olli Aro wrote:
> Aaah, I remember now. That is why I suggested the custom parser in the first
> place.
> 
> So, in that case your code would be something like this:
> 
> public void visitTag(Tag tag) {
>     	 
>     	   //Parse links
>          if(tag.getTagName().equals("A")){
> 
> 		String link=tag.getAttribute("HREF");
>         	 
>         	myMethodAppendingToFile(link);
>          }
>          
>          super.visitTag(tag);
>      }
> 
> Regards,
> 
> Olli
> 
> -----Original Message-----
> From: Christoph P. Kukulies [mailto:kuku at physik.rwth-aachen.de] 
> Sent: 26 September 2008 17:08
> To: olli_aro at yahoo.co.uk; The OpenCms mailing list
> Subject: Re: [opencms-dev] <cms:parse> usage
> 
> On Fri, Sep 26, 2008 at 03:03:37PM +0100, Olli Aro wrote:
> > Well you cannot paste that code in as it is in your CustomVisitor, since
> it
> > includes references to all kind of bespoken stuff we have. It was just an
> > illustration on how to use the parsers and add width and height property
> to
> > image tags that are missing it.
> > 
> > Maybe it would help if you tell me what you are hoping to achieve with
> your
> > custom parser and then I can give you pointers on how to do it?
> 
> 
> Actually I was seeking a way to write out all links in my pages into a
> file. Something that wget -r does from the outside.
> 
> 
> --
> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
> 
> > 
> > Regards,
> > 
> > Olli
> > 
> > -----Original Message-----
> > From: Christoph P. Kukulies [mailto:kuku at physik.rwth-aachen.de] 
> > Sent: 26 September 2008 14:43
> > To: olli_aro at yahoo.co.uk; The OpenCms mailing list
> > Subject: Re: [opencms-dev] <cms:parse> usage
> > 
> > 
> > Hi Olli,
> > 
> > I'm following this thread with great interest. Still I - me mundane -
> > have no idea where one should put that code piece below.
> > 
> > 
> > On Fri, Sep 26, 2008 at 02:05:58PM +0100, Olli Aro wrote:
> > > The whole point of this is that you can parse through the content inside
> > the
> > > tag and do what ever you like with that content. The most common
> > application
> > > would be to manipulate content. For example we have used this in order
> to
> > > ensure that all images in the content have width and height attributes
> > set.
> > > 
> > > Below is some code for you for this application:
> > > 
> > > /*
> > >       * (non-Javadoc)
> > >       * @see org.opencms.util.CmsHtmlParser#visitTag(org.htmlparser.Tag)
> > >       */
> > >      public void visitTag(Tag tag) {
> > >     	 
> > 
> > ....
> > 
> > --
> > Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list