Alberto reda at
Tue Feb 13 03:37:58 PST 2007

I can write xml on buffer/file without  problems, but I have some little
problem parsing an xml from a buffer.
This is part of the sax example:

void readerTest3()
	ISAXReader!(T) reader = new TeqXMLReader!(T)(256);
	FileConduit file = new FileConduit("sample-32BE.xml",
	MyOutputHandler handler = new MyOutputHandler();
	reader.parse(file, handler, Encoding.UTF_32);

I read the sax source:
   All SAX parsers must implement this interface.
interface ISAXReader(T=char) {
	   Tells the parser to begin processing a document

	   	source =	The IConduit that the parser should draw xml content from
		handler =	The client interface who's methods the parser should call
		encoding =	If the client knows it, tell the parser the text encoding
of the incoming XML.
				If not specified, the parser will guess, and failing that assume
UTF8N.  The
				enum for these types is in mango.convert.Unicode.
	public void parse(IConduit source, ISAXHandler!(T) handler, Encoding

I must pass a conduit, ok.
I have tried to use MemoryConduit (I suppose that is the right way to do
what I want) but without success, something like:

char[] msg = "blabla";
char[] xml;
auto mc = new MemoryConduit();
auto write = new Writer (mc);
auto read = new Reader (mc);
write (msg);
xml.length = msg.length;
read (xml);

this give me:
end-of-file whilst reading

I can't use the method writer because is not accessible, so how can I
use MemoryConduit?

More information about the Digitalmars-d-learn mailing list