|
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
| ||||||
