Is a SAX Parser capable of capturing mixed content within an XML document (see example below)?
<element>here is some <b>mixed content</b></element>
Is a SAX Parser capable of capturing mixed content within an XML document (see example below)?
<element>here is some <b>mixed content</b></element>
Of course. You get the following events:
Yes, although I'm not sure what you mean by capturing. If you run the short example below, you'll see the startElement handler called for both element and b:
String xml = "<element>here is some <b>mixed content</b></element>";
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(new ByteArrayInputStream(xml.getBytes()), new DefaultHandler(){
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
System.out.println("Started: "+name);
}
});