cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: New HighlightingTransformer
Date Fri, 30 Sep 2005 12:36:47 GMT
Currently, there is no schema or DTD necessary at the moment. I have created a class, XmlToMapHandler(),
 with which the keywords file is parsed, looking for the element "keyword". From a keyword
element it needs a "value" attribute, and an optional "href" atrribute 
 
So,
 
<anyXML>
    <keyword value="cocoon" href="  <http://cocoon.apache.org> http://cocoon.apache.org"
 /> 
</anyXML>
 
would do fine. Of course, you're free to modify the XmlToMapHandler() to your own schema or
DTD. You can change it into handling your existing keyword/theasuarus whatever file. 
 
Currently, it is something like
 
XmlToMapHandler xmlToMapHandler =  new XmlToMapHandler();
parser.parse(new InputSource(inputSource.getInputStream()), xmlToMapHandler); 
keywordMap = xmlToMapHandler.getMap();
 
 
public class XmlToMapHandler extends DefaultHandler {
 
    private HashMap m_hashmap =  new HashMap();
    
    public  XmlToMapHandler()
    {
       super();
    }
    
    public Map getMap(){
        return m_hashmap;
    }
    
    public void startElement(String uri, String localName, String qName,
    Attributes attributes) throws SAXException {
          if (qName.equals("keyword")){
             if(attributes.getValue("value") != null && !m_hashmap.containsKey(attributes.getValue("value"))){
                m_hashmap.put(attributes.getValue("value"), attributes.getValue("href"));
             }
             
          }
    }
}
 
Ard
 
 -----Original Message-----
From: Geert Josten [mailto:geert.josten@daidalos.nl]
Sent: vrijdag 30 september 2005 14:02
To: dev@cocoon.apache.org
Subject: RE:New HighlightingTransformer



Just out of curiousity: what is the DTD for the keywords file?
 
Cheers,
Geert
   

 

Drs. G.P.H. Josten

Consultant

 

 

 <http://www.daidalos.nl/> 


Daidalos BV

Source of Innovation

Hoekeindsehof 1-4

2665  JZ  Bleiswijk

Tel.: +31 (0) 10 850 1200 

Fax: +31 (0) 10 850 1199

 <http://www.daidalos.nl/> www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

 


-----Oorspronkelijk bericht----- 
Van: Ard Schrijvers [mailto:a.schrijvers@hippo.nl] 
Verzonden: vr 30-9-2005 13:39 
Aan: dev@cocoon.apache.org 
CC: 
Onderwerp: New HighlightingTransformer


 

 

Mime
View raw message