[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qexo-general] Using the SAX API
From: |
Alessandro Vernet |
Subject: |
Re: [Qexo-general] Using the SAX API |
Date: |
Thu, 05 Jun 2003 17:51:47 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 |
Per Bothner wrote:
I checked in a fix for this. Thanks for your bug report and test case.
Hi Per,
Thank you for the fix. It works much better. I am just having a
problem with null names in attributes. (See the attached test case.)
Alex
import gnu.xquery.lang.XQuery;
import gnu.kawa.sax.ContentConsumer;
import java.io.StringWriter;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.Locator;
import org.xml.sax.Attributes;
public class Test {
public static void main(String[] args) {
try {
XQuery xquery = new XQuery();
ContentConsumer contentConsumer = new ContentConsumer(new
DebugContentHandler());
xquery.eval("<a x=\"y\"/>", contentConsumer);
} catch (Throwable throwable) {
throw new RuntimeException(throwable);
}
}
public static class DebugContentHandler implements ContentHandler {
public void characters(char ch[], int start, int length)
throws SAXException {
}
public void endDocument()
throws SAXException {
}
public void endElement(String namespaceURI, String localName,
String qName)
throws SAXException {
}
public void endPrefixMapping(String prefix)
throws SAXException {
}
public void ignorableWhitespace(char ch[], int start, int length)
throws SAXException {
}
public void processingInstruction(String target, String data)
throws SAXException {
}
public void setDocumentLocator(Locator locator) {
}
public void skippedEntity(String name)
throws SAXException {
}
public void startDocument()
throws SAXException {
}
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts)
throws SAXException {
System.out.println("startElement: " + namespaceURI + " " + qName);
for (int i = 0; i < atts.getLength(); i++) {
System.out.println(" local name: " + atts.getLocalName(i));
System.out.println(" value: " + atts.getValue(i));
}
}
public void startPrefixMapping(String prefix, String uri)
throws SAXException {
}
}
}
- Re: [Qexo-general] Using the SAX API,
Alessandro Vernet <=