Hello,

in one of my custom generators I have to query a db attribute wich contains
an xml-fragment. I do this by my addXML() method.
An although it seems to produce the correct sax events, my transformers
NEVER do apply anything to the resulting xml.

Two possibilities:
- it is wrong to use CLOB for XML fragments in DB2
- my addXML is producing wrong output

--------- my generator -------------
.....
                startSimpleElement("ABSTRACT", attr);

                    addSimpleTag("UEBERSCHRIFT", item.getUeberschrift());
                    addSimpleTag("ZUSAMMENFASSUNG",
item.getZusammenfassung());
                    addSimpleTag("BILD", item.getBild());

                    // muss noch als XML geparst werden!
                    addXML(item.getText());


                endSimpleElement("ABSTRACT");

 ....
   protected void addXML(String xml) {
 try {
     javax.xml.parsers.SAXParser parser =
javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser();
     xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + xml;
     parser.parse(new StringBufferInputStream(xml), new DefaultHandler() {
  public void characters(char[] ch, int start,int length) throws
SAXException {
      contentHandler.characters(ch, start, length);
  }

  public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
      contentHandler.startElement(uri, localName, qName, attributes);
  }

  public void endElement(String uri, String localName, String qName) throws
SAXException {
      contentHandler.endElement(uri, localName, qName);
  }
     });
 } catch (Exception e) {
 }
    }

............................................................................



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to