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:[EMAIL PROTECTED]
Sent: vrijdag 30 september 2005 14:02
To: [email protected]
Subject: RE:New HighlightingTransformer

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

 

Drs. G.P.H. Josten

Consultant

 

 

Daidalos BV

Source of Innovation

Hoekeindsehof 1-4

2665  JZ  Bleiswijk

Tel.: +31 (0) 10 850 1200

Fax: +31 (0) 10 850 1199

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:[EMAIL PROTECTED]
Verzonden: vr 30-9-2005 13:39
Aan: [email protected]
CC:
Onderwerp: New HighlightingTransformer

 

 

Reply via email to