--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/PDK/Source/GUID-23014C8A-2A0B-5F6A-9BB2-6642E1EC0462.dita Fri Jan 22 18:26:19 2010 +0000
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
+<!-- This component and the accompanying materials are made available under the terms of the License
+"Eclipse Public License v1.0" which accompanies this distribution,
+and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
+<!-- Initial Contributors:
+ Nokia Corporation - initial contribution.
+Contributors:
+-->
+<!DOCTYPE concept
+ PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
+<concept id="GUID-23014C8A-2A0B-5F6A-9BB2-6642E1EC0462" xml:lang="en"><title>Using
+Content Processor</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>This section explains how to implement the <codeph>MContentProcessor</codeph> interface
+to parse, validate and autocorrect an XML document. </p>
+<section><title>Introduction</title> <p>The parsed document can also be validated
+against a specification and auto-corrected for spelling errors in the validated
+text. This can be done by writing three applications - a parser, a validator
+and an autocorrector. These applications must implement the <xref href="GUID-7942EDC6-6571-3423-8ECA-D3DB68A78CB6.dita"><apiname>MContentProcessor</apiname></xref> interface. </p> <p>Writing
+a content processor is similar to writing a content handler as explained in <xref href="GUID-AF937B6E-7BC0-5B7D-818E-93F7CAFD8808.dita">Parsing an XML Document</xref>. <xref href="GUID-7942EDC6-6571-3423-8ECA-D3DB68A78CB6.dita"><apiname>MContentProcessor</apiname></xref> is
+an extension of <xref href="GUID-A6B8386B-29F6-3BEC-9D77-D8E0900DEAC2.dita"><apiname>MContentHandler</apiname></xref>. Each application is writen
+by implementing the callback functions of <xref href="GUID-A6B8386B-29F6-3BEC-9D77-D8E0900DEAC2.dita"><apiname>MContentHandler</apiname></xref>.
+The only difference is that <xref href="GUID-7942EDC6-6571-3423-8ECA-D3DB68A78CB6.dita"><apiname>MContentProcessor</apiname></xref> has a mechanism
+for directing output, so that the output of the parser is the input to the
+validator, and the output of the validator is the input to the autocorrector. </p> <p>Direct
+output of a content processor by implementing the <xref href="GUID-DCF5D3DD-C7FC-3ED0-86E8-63C5E85795B8.dita"><apiname>SetContentSink()</apiname></xref> function,
+so that the parser outputs to the validator and the validator outputs to the
+autocorrector. A sequence of several applications linked in this way is called
+a <b>Plug-in Chain</b>. </p> </section>
+<section><title>Procedure</title> <ol id="GUID-F18654E9-0325-5111-9D00-5196196BD0D5">
+<li id="GUID-324DEAF3-690F-5DA0-9DD0-C16533114B0E"><p>Implement the <codeph>MContentProcessor</codeph> interface. </p> </li>
+<li id="GUID-97B4EA3B-3CF1-582E-864C-73EF0FA1A1EC"><p>Implement the <xref href="GUID-7942EDC6-6571-3423-8ECA-D3DB68A78CB6.dita#GUID-7942EDC6-6571-3423-8ECA-D3DB68A78CB6/GUID-F33A8F75-B1FB-30DF-B829-DFC6D2CD29E1"><apiname>MContentProcessor::SetContentSink()</apiname></xref> function. </p> </li>
+<li id="GUID-6A95E431-C203-5442-BDD8-AEF0FD19AE72"><p>Perform the actual parsing. </p> <p>Use
+a <codeph>CParser</codeph> object as explained in <xref href="GUID-E16070E5-379A-5818-81CC-B00059A40084.dita">Choosing
+a Parser Plug-in</xref>. To ensure that parsing is followed by validation
+and autocorrection, associate the <codeph>CParser</codeph> object with the
+plug-in chain. This can be done by calling <xref href="GUID-667DBD60-ABF3-326B-8FF9-86BC7DC7662F.dita"><apiname>SetProcessorChainL()</apiname></xref> function
+of the <codeph>CParser</codeph> object with a list of the items in the plugin
+chain as a parameter. </p> <p>The following code illustrates how to validate
+and autocorrect the parsed document: </p> <codeblock id="GUID-39142F60-28D0-55FF-B9B3-DB5149638C2C" xml:space="preserve">RFs fs;
+User::LeaveIfError( fs.Connect() );
+CleanupClosePushL( fs );
+
+_LIT8( KXmlMimeType, "text/xml" );
+TSimpleContentHandler sax; // You’ll have to implement this class…
+
+CParser* parser = CParser::NewLC( KXmlMimeType, sax );
+
+RContentProcessorUids uids;
+uids.Append( KValidatorUid ); // The ECOM implementation UID of a validator plug-in
+CleanupClosePushL( uids );
+
+// Sets up the chain of call-back events from the parser through to the
+// validating plug-in and then the client.
+parser->SetProcessorChainL( uids );
+
+parser->ParseFileL( fs, KMyFile );
+
+CleanupStack::PopAndDestroy( 3 );</codeblock> </li>
+</ol> </section>
+</conbody></concept>
\ No newline at end of file