#include "cconsolestream.h"
#include "cfilestream.h"
using namespace P6R;
using namespace P6EXAMPLES;
namespace {
{
if(
P6SUCCEEDED(err = cpFileInit->initialize(pszFilepath))) {
}
}
return err;
}
{
}
}
return err;
}
{
}
}
return err;
}
{
{
err = pXPath->
eval( pDOM, NULL, NULL, &result );
{
if (1 != number) {
pConsole->
writeStdout(
"node set size returned by last() function is %1$\n",&args[0],1,NULL);
return eFail;
}
{
{
retval = -1;
if (0 != retval) {
pConsole->
writeStdout(
"node name - expected [ title ] but got [ %1$ ]\n", &args[0],2,NULL );
return err;
}
}
{
retval = -1;
err = pStr->
wstrncmp(
P6CTEXT(
"P6R book of development"), pString, 23, &retval );
if (0 != retval) {
pConsole->
writeStdout(
"child node value - Expected [ P6R book of development ] but got [ %1$ ]\n", &args[0],1,NULL );
return eFail;
}
}
}
{
}
}
}
return err;
}
{
{
pConsole->
writeStdout(
"Expected %1$ but got %2$\n", &args[0], 2, NULL );
return eFail;
}
number = 0;
if (number != 5) {
pConsole->
writeStdout(
"Expected 5 but got %1$\n", &args[0], 1, NULL );
return eFail;
}
count = 0;
{
retval = -1;
{
switch( count ) {
case 0: err = pStr->
wstrncmp(
P6CTEXT(
"1 2 3\xE9\xE9 4 5 6"), testStr, 13, &retval );
break;
case 1: err = pStr->
wstrncmp(
P6CTEXT(
"7 8 9 10 11"), testStr, 11, &retval );
break;
case 2: err = pStr->
wstrncmp(
P6CTEXT(
"a b c d e f g h"), testStr, 15, &retval );
break;
case 3: err = pStr->
wstrncmp(
P6CTEXT(
"0 0 0 0 0 0 "), testStr, 12, &retval );
break;
case 4: err = pStr->
wstrncmp(
P6CTEXT(
"i j k l m n o p"), testStr, 15, &retval );
break;
}
if (retval != 0) {
pConsole->
writeStdout(
"Case %1$ failed. Expected string does not match\n", &args[0], 1, NULL );
return eFail;
}
count++;
}
}
if (eEndOfRecord == err) err = eOk;
{
{
{
if (retval != 0) {
pConsole->
writeStdout(
"sorting - expected [ i j k l m n o p ] but got %1$\n", &args[0], 1, NULL );
return eFail;
}
}
}
}
{
}
}
return err;
}
{
"<?xml version='1.0' encoding='UTF-8' ?>" \
"<book>" \
"<title>P6R book of development</title>" \
"<TOC>" \
" <chapter>One</chapter>" \
" <chapter>Two</chapter>" \
"</TOC>" \
"<chapter>" \
" <section>" \
" <footnote>footnote 1.1.0</footnote>" \
" <para>1 2 3éé 4 5 6</para>" \
" <para>7 8 9 10 11</para>" \
" <testcase> abc <![CDATA[ abéc > 123 ]]> hey there </testcase>" \
" </section>" \
" <section>" \
" <para>a b c d e f g h</para>" \
" <footnote>footnote 1.2.0</footnote>" \
" <footnote id='ab'>footnote 1.2.1</footnote>" \
" </section>" \
"</chapter>" \
"<chapter>" \
" <para>0 0 0 0 0 0 </para>" \
" <section>" \
" <para>i j k l m n o p</para>" \
" <footnote>footnote 1.3.0</footnote>" \
" </section>" \
"</chapter>" \
"<index>" \
" <item>Index 1.0</item>" \
" <item>Index 2.0</item>" \
" <abc>" \
" <item>Index 2.1</item>" \
" <item>Index 2.2</item>" \
" </abc>" \
" <item>Index 3.0</item>" \
"</index>" \
"<appendixA>" \
" <item>appendix A 1.0</item>" \
" <item>appendix A 2.0</item>" \
"</appendixA>" \
"<appendixB>" \
" <item>appendix B 1.0</item>" \
" <item>appendix B 2.0</item>" \
" <item>appendix B 3.0</item>" \
"</appendixB>" \
"<appendixC>" \
" <item>appendix C 1.0</item>" \
" <abc>" \
" <item>appendix C 2.0</item>" \
" </abc>" \
"</appendixC>" \
"</book>";
cpStr->
strlen( pXML, 100000, &bufSize );
err = findNodesExample(pConsole,cpStr,cpDOM,cpXPath);
err = getNodeSequenceExample(pConsole,cpStr,cpDOM,cpXPath);
pConsole->
writeStdout(
"ERROR: Example failed with [ %1$ ]\n", &args[0], 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 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;
}