> This code "generates" the XML that worked with the first example.
>
> However, when I try this, the output from Xalan doesn't have anything
> from my generated SAX/XML.
>
> Can anyone point me in the right direction ?
I was doing this only the other day...
The solution I arrived at was to implement an XMLFilter that generated the
false events from within the parse(String) method. The content handler will
receive the fake events as if it had parsed a file, with the whole process
kicked off by calling parse("dummy") on the Filter. A cut down looks like this:
public class Whatever implements XMLReader {
private ContentHandler m_contentHandler = null;
...implement all of the interface methods here....
public void parse(String s) {
m_contentHandler.startDocument();
m_contentHandler.startElement("", "Foo", "Foo", new AttributesImpl());
m_contentHandler.endElement("", "Foo", "Foo");
m_contentHandler.endDocument();
}
}
This will give you a 'fake' xml document of exactly
<Foo/>
cheers
andrew
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 06/05/2003