[Xmlstorage-commits] SF.net SVN: xmlstorage: [76] trunk/c++
Brought to you by:
martinfuchs
From: <mar...@us...> - 2008-01-30 23:07:50
|
Revision: 76 http://xmlstorage.svn.sourceforge.net/xmlstorage/?rev=76&view=rev Author: martinfuchs Date: 2008-01-30 15:07:48 -0800 (Wed, 30 Jan 2008) Log Message: ----------- example 4 to show usage of set_content() and get_content() Added Paths: ----------- trunk/c++/example4.cpp trunk/c++/example4.dsp Added: trunk/c++/example4.cpp =================================================================== --- trunk/c++/example4.cpp (rev 0) +++ trunk/c++/example4.cpp 2008-01-30 23:07:48 UTC (rev 76) @@ -0,0 +1,91 @@ + + // + // XML storage classes + // + // example4.cpp + // + // Copyright (c) 2007 Martin Fuchs <mar...@gm...> + // + + +/* + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include <xmlstorage.h> +using namespace XMLStorage; + +#include <iostream> +using namespace std; + + +void test_write() +{ + XMLWriter out("enum-children.xml"); + + out.create("Test"); + out.create("Child"); + out.set_content("Wert1"); + out.back(); + + out.create("Child"); + out.set_content("Wert2"); + out.back(); + out.back(); +} + + +void test_read() +{ + XMLDoc doc; + + // Einlesen des XML-Files + doc.read_file("enum-children.xml"); + + XMLPos pos(&doc); + + if (pos.go("Test")) { + const_XMLChildrenFilter children(pos, "Child"); + + for(const_XMLChildrenFilter::const_iterator it=children.begin(); it!=children.end(); ++it) { + const XMLNode* node = *it; + + cout << node->get_content() << endl; + } + + pos.back(); + } +} + + +int main() +{ + test_write(); + test_read(); + + return 0; +} Property changes on: trunk/c++/example4.cpp ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/c++/example4.dsp =================================================================== --- trunk/c++/example4.dsp (rev 0) +++ trunk/c++/example4.dsp 2008-01-30 23:07:48 UTC (rev 76) @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="example4" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=example4 - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "example4.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "example4.mak" CFG="example4 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "example4 - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "example4 - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "example4 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /FD /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 /nologo /subsystem:console /machine:I386 +# SUBTRACT LINK32 /verbose + +!ELSEIF "$(CFG)" == "example4 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /FR /FD /GZ /c +# SUBTRACT CPP /YX +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "example4 - Win32 Release" +# Name "example4 - Win32 Debug" +# Begin Source File + +SOURCE=".\enum-children.xml" +# End Source File +# Begin Source File + +SOURCE=.\example4.cpp +# End Source File +# End Target +# End Project Property changes on: trunk/c++/example4.dsp ___________________________________________________________________ Name: svn:eol-style + CRLF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |