#include "cconsolestream.h"
#include "cfilestream.h"
using namespace P6R;
using namespace P6EXAMPLES;
namespace {
{
if(
P6SUCCEEDED(err = cpFileInit->initialize(pszFilepath))) {
}
}
return err;
}
{
if(
P6SUCCEEDED(err = cpDOM->initialize(P6DOMXML_NOFLAGS,pOutStream))) {
}
}
return err;
}
{
err = cpDOM->getRootNode( cpRoot.
addressof() );
err = cpRoot->addChild( cpParent );
err = cpParent->addAttribute(
P6CTEXT(
"xmlns:P6R"), 9,
NULL, 0 );
cpChild->setName(
P6CTEXT(
"one-one"), 7 );
err = cpParent->addChild( cpChild );
err = cpChild->addAttribute(
P6CTEXT(
"id"), 2,
NULL, 0 );
err = cpChild->addAttribute(
P6CTEXT(
"lang"), 4,
NULL, 0 );
cpText->setValue(
P6CTEXT(
"Stony Brook University"), 22 );
err = cpChild->addChild( cpText );
cpSubChild->setName(
P6CTEXT(
"P6R:one-one-one"), 15 );
err = cpChild->addChild( cpSubChild );
cpText->setValue(
P6CTEXT(
"13,000 students"), 15 );
err = cpSubChild->addChild( cpText );
cpChild->setName(
P6CTEXT(
"one-two"), 7 );
err = cpParent->addChild( cpChild );
cpChild->setName(
P6CTEXT(
"one-three"), 9 );
err = cpParent->addChild( cpChild );
cpSubChild->setName(
P6CTEXT(
"one-three-one"), 13 );
err = cpChild->addChild( cpSubChild );
cpText->setValue(
P6CTEXT(
"University of California, Los Angeles"), 37 );
err = cpSubChild->addChild( cpText );
{
cpChild->setName(
P6CTEXT(
"one-four"), 8 );
err = cpParent->addChild( cpChild );
valueLength = 100;
cpStr->formatStringW( value, valueLength, &valueLength,
P6CTEXT(
"red car #%1$"), &args, 1 );
cpText->setValue( (
const P6WCHAR*)value, 10 );
err = cpChild->addChild( cpText );
}
cpChild->setName(
P6CTEXT(
"one-five"), 8 );
err = cpParent->addChild( cpChild );
cpText->setValue(
P6CTEXT(
"end of items"), 12 );
err = cpChild->addChild( cpText );
cpChild->setName(
P6CTEXT(
"one-six"), 7 );
err = cpParent->addChild( cpChild );
cpText->setValue(
P6CTEXT(
"44"), 2 );
err = cpChild->addChild( cpText );
cpChild->setName(
P6CTEXT(
"one-six"), 7 );
err = cpParent->addChild( cpChild );
cpText->setValue(
P6CTEXT(
"197"), 3 );
err = cpChild->addChild( cpText );
err = cpDOM->output( cpOutStream1, P6DOMOUTPUT_XML );
err = cpDOM->output( cpOutStream2, P6DOMOUTPUT_JSON );
pConsole->
writeStdout(
"example failed [ %1$ ]\n",&args,1,NULL);
}
return err;
}
}
int main(int argc,char *argv[])
{
{
{
err = runDOM( cpConsole, cpDebugStream );
cpConsole->writeStdout("runDOM result: [ %1$ ]\n",&args[0],1,NULL);
cpConsole = NULL;
}
}
else printf("ERROR: Failed to initialize the loader [ %x ]\n", err );
}
else printf( "ERROR: Failed to create CConsoleStream [ %x ]\n", err );
return err;
}