#include "cconsolestream.h"
#include "ccontenthandler.h"
using namespace P6R;
using namespace P6EXAMPLES;
namespace P6EXAMPLES {
{
if (
P6SUCCEEDED( err = cpSAX->initialize( P6SAX2_NOFLAGS ))) {
if (
P6SUCCEEDED( err = cpSAX->setFeature(
"http://xml.org/sax/features/namespaces",
P6TRUE ))) {
if (
P6SUCCEEDED( err = cpSAX->setFeature(
"http://xml.org/sax/features/namespaces-prefixes",
P6TRUE ))) {
}
}
}
}
return err;
}
{
if (
P6SUCCEEDED( err = cpInit->initialize( pConsole, pStr ))) {
}
}
return err;
}
{
pChunk[ 0] = "<?xml version='1.0' enco";
pChunk[ 1] = "ding='UTF-8' ?>";
pChunk[ 2] = "<fir";
pChunk[ 3] = "st xmlns:xslt='http://www.w";
pChunk[ 4] = "3.org/1999/XSL/Transform'>";
pChunk[ 5] = " <second temp='55' xmlns:X='http://www.w3.org/TR/REC-html40'><xslt";
pChunk[ 6] = ":if test='123'><![CDATA[ one two three]]><";
pChunk[ 7] = "/xslt:if></second><third color = '> green' name='Jon\r\nSmith' weight='3453'>";
pChunk[ 8] = " four five si";
pChunk[ 9] = "x seven";
pChunk[10] = " </third>";
pChunk[11] = "<test>Now is the time<![CDATA[ for <all >good ]";
pChunk[12] = "]>men to come to the aid &";
pChunk[13] = "amp; support.</test></first>";
pChunk[14] = "";
pChunk[15] = NULL;
err = cpReader->setContentHandler( cpContent );
}
pBuffer = pChunk[ index++ ];
err = cpStr->strlen( pBuffer, 100000, &bufSize );
{
err = cpStream->processStream( pBuffer, (
P6UINT32)bufSize );
pBuffer = pChunk[ index++ ];
err = cpStr->strlen( pBuffer, 100000, &bufSize );
}
err = cpStream->endStream();
cpStream = NULL;
pConsole->
writeStdout(
"ERROR: Example failed with [ %1$ ]\n", &args[0], 1, NULL );
}
return err;
}
}
int main(int argc,char *argv[])
{
err = runSAX2( cpConsole, cpDebugStream );
cpConsole->writeStdout("runSAX2 result: [ %1$ ]\n",&args[0],1,NULL);
cpConsole = NULL;
}
else printf("ERROR: Failed to retrieve console interface [ %x ]\n", err );
}
else printf("ERROR: Failed to initialize the loader [ %x ]\n", err );
}
else printf( "ERROR: Failed to create CConsoleStream [ %x ]\n", err );
return err;
}