- wfc.zip
- wfc
- sample.zip
- sample
- Sample
- ADO2XML
- ChangeServiceConfiguration
- ClockSync
- Counter
- Crypto
- CScript
- Data
- DeMangle
- DriverMover
- dump_ntfs_streams.cpp
- DumpEventLog
- EnableRASLogging
- EventPager
- GetWebPage
- HTML
- KillDoc
- LastEvent
- Listen
- ListProcesses
- MAKEMC.CMD
- Map2Def
- Microphone
- MIME2HTML
- PasswordFilter
- Ping
- Pinger
- RasAdmin
- Serial
- SerialTest
- Service
- SkyPage
- SprintSpectrum
- Squiggle
- TortureXML
- USNOTime
- WatchDog
- Wfc2Html
- WinPage
- XML
- XMLCheck
- XMLExplorer
- XMLUser
- TEST
- html.zip
- HTML
|
#include "XMLUser.h"
#pragma hdrstop
/*
** Author: Samuel R. Blackburn
** Internet: wfc@pobox.com
**
** You can use it any way you like as long as you don't try to sell it.
**
** Any attempt to sell WFC in source code form must have the permission
** of the original author. You can produce commercial executables with
** WFC but you can't sell WFC.
**
** Copyright, 1998, Samuel R. Blackburn
**
** $Workfile: parse_document.cpp $
** $Revision: 1 $
** $Modtime: 6/14/98 9:39a $
*/
#if defined( _DEBUG )
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG
void user_element_callback( void * parameter, CExtensibleMarkupLanguageElement * element_p )
{
WFCTRACEINIT( TEXT( "user_element_callback()" ) );
_tprintf( TEXT( "in user_element_callback\n" ) );
// SCHWEET! We have a user element
CByteArray names;
CXMLArchive archive;
archive.ReadFrom( element_p );
if ( archive.Read( TEXT( "BINARY" ), names ) == NULL )
{
WFCTRACE( TEXT( "Can't find BINARY" ) );
_tprintf( TEXT( "Can't find BINARY" ) );
return;
}
WFCTRACEVAL( TEXT( "Number of strings is " ), names.GetSize() );
CFile output_file;
if ( output_file.Open( TEXT( "c:\\temp\\output.bin" ), CFile::modeCreate | CFile::modeWrite ) == FALSE )
{
WFCTRACE( TEXT( "Can't create output.bin" ) );
return;
}
output_file.Write( names.GetData(), names.GetSize() );
}
void parse_document( void )
{
WFCTRACEINIT( TEXT( "parse_document()" ) );
CExtensibleMarkupLanguageDocument document;
CFile file;
// if ( file.Open( TEXT( "users.xml" ), CFile::modeRead ) == FALSE )
if ( file.Open( TEXT( "c:\\temp\\stuff.xml" ), CFile::modeRead ) == FALSE )
{
WFCTRACE( TEXT( "Can't open stuff.xml" ) );
_tprintf( TEXT( "Can't open users.xml\n" ) );
return;
}
CByteArray bytes;
bytes.SetSize( file.GetLength() );
file.Read( bytes.GetData(), bytes.GetSize() );
file.Close();
CDataParser parser;
parser.Initialize( &bytes, FALSE );
document.AddCallback( TEXT( "USER" ), user_element_callback, NULL );
if ( document.Parse( parser ) == FALSE )
{
WFCTRACE( TEXT( "Can't parse" ) );
}
else
{
WFCTRACE( TEXT( "Parsed OK" ) );
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I'm just a simple little NT programmer. Most of the work I do is remote controlling equipment in real time. I started out using Windows 3.0. Then came 3.1 and then NT. I started using NT but unfortunately, Microsoft didn't. I started using MFC but unfortunately, Microsoft didn't (and
still doesn't) put any real support for NT into MFC so I wrote a bunch of C++ classes to make my life easier. Like all class libraries, mine grew. Now I'm giving it away, I call it Win32 Foundation Classes.
Check out Sam's homepage at
www.SamBlackburn.com/wfc/.