OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] DTD parser in c#

[ Lists Home | Date Index | Thread Index ]

Hi Karl,

Thanks for your reply. I have tested it and I encounter some error as below.
Please advise.

The type or namespace name 'IXMLReader' could not be found
The type or namespace name 'reader' could not be found
The type or namespace name 'IProperty' could not be found
The type or namespace name 'lexProp' could not be found
The type or namespace name 'StreamInputSource' could not be found

I already include sax.dll and system.dll in this project. Please advise.

----- Original Message ----- 
From: "Karl Waclawek" <karl@waclawek.net>
To: "Michelle Tan" <tjtan79@streamyx.com>; <xml-dev@lists.xml.org>
Sent: Monday, March 29, 2004 11:42 PM
Subject: Re: [xml-dev] DTD parser in c#


>
> > Could you please share sample coding how to read a file into SAX.NET?
>
> Sure, here it is (from memory, not tested):
>
> IXMLReader reader = new KDS.Xml.Expat.ExpatReader();
> // or if a default parser is configured:
> // IXMLReader reader = SAXReaderFactory.CreateReader(null);
> FileStream fileStm = new FileStream(myFileName, FileMode.Open,
FileAccess.Read);
>
> // maybe turn namespaces on
> reader.SetFeature(System.Xml.Sax.Constants.namespacesFeature, true);
> // set call-back handlers
> reader.ErrorHandler = myErrorHandler;
> reader.ContentHandler = myContenthandler;
> IProperty declProp = reader.GetProperty(
>               System.Xml.Sax.Constants.declHandlerProperty);
> declProp.Value = myDeclhandler;
> IProperty lexProp = reader.GetProperty(
>               System.Xml.Sax.Constants.lexicalHandlerProperty);
> lexProp.Value = myLexicalhandler;
> // process the file
> try {
>   reader.Parse(new StreamInputSource(fileStm));
> }
> finally {
>    fileStm.Close();
> }
>
>
> Karl
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS