You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by au...@apache.org on 2001/02/06 17:50:19 UTC

cvs commit: xml-xalan/c/samples/XalanTransform foo.html foo.xml XalanTransform.cpp XalanTransform.dsp

auriemma    01/02/06 08:50:19

  Added:       c/samples/XalanTransform foo.html foo.xml XalanTransform.cpp
                        XalanTransform.dsp
  Log:
  New sample XalanTransformer. Demonstrates how to use the (simple C++ interface) class XalanTransformer.
  
  Revision  Changes    Path
  1.1                  xml-xalan/c/samples/XalanTransform/foo.html
  
  Index: foo.html
  ===================================================================
  <html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>s1 foo</title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
  <table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr>
  <td bgcolor="#006699"><font color="#ffffff" size="+1"><b>Foo</b></font></td>
  </tr>
  </table>
      <p>Hello</p>
    <br>
  </body>
  </html>
  
  
  
  1.1                  xml-xalan/c/samples/XalanTransform/foo.xml
  
  Index: foo.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE si>
  <s1 title="s1 foo">
    <s2 title="Foo">
      <p>Hello</p>
    </s2>
  </s1>
  
  
  1.1                  xml-xalan/c/samples/XalanTransform/XalanTransform.cpp
  
  Index: XalanTransform.cpp
  ===================================================================
  
  
  
  #include <XalanTransformer/XalanTransformer.hpp>
  
  
  
  #include <strstream>
  
  
  
  int
  main(
  			int				 argc,
  			const char*		 argv[])
  {
  #if !defined(XALAN_NO_NAMESPACES)
  	using std::ostrstream;
  	using std::cout;
  	using std::cerr;
      using std::endl;
  #endif
  
      if (argc < 3 || argc > 4)
  	{
  		cerr << "Usage: XalanTransform XMLFileName XSLFileName [OutFileName]" << endl;
  		return -1;
  	}
  
      // Initialize Xalan.
      XalanTransformer::initialize();
  
      // Create a XalanTransformer.
  	XalanTransformer theXalanTransformer;
  
  	const char* 	theXMLFileName = argv[1];
  	const char* 	theXSLFileName = argv[2];
  
      int				theResult = 0;
  
      if (argc == 4)
  	{
  	    const char* 		theOutFileName = argv[3];
  
          // Do the transform.
          theResult = theXalanTransformer.transform(theXMLFileName, theXSLFileName, theOutFileName);
          
          if(theResult != 0)
  	    {
  		    cerr << "XalanError: \n" << theXalanTransformer.getLastError();
  	    }
      }
      else
      {
          ostrstream	theOutput;
  
          // Do the transform.
          theResult = theXalanTransformer.transform(theXMLFileName, theXSLFileName, theOutput);
          
          if(theResult != 0)
  	    {
  		    cerr << "XalanError: \n" << theXalanTransformer.getLastError();
  	    }
  	    else
  	    {
  		    theOutput << '\0';
  
  		    cout << theOutput.str();
  	    }
      }
  
      // Terminate Xalan.
  	XalanTransformer::terminate();
  
  	return theResult;
  }
  
  
  1.1                  xml-xalan/c/samples/XalanTransform/XalanTransform.dsp
  
  Index: XalanTransform.dsp
  ===================================================================
  # Microsoft Developer Studio Project File - Name="XalanTransform" - Package Owner=<4>
  # Microsoft Developer Studio Generated Build File, Format Version 6.00
  # ** DO NOT EDIT **
  
  # TARGTYPE "Win32 (x86) Console Application" 0x0103
  
  CFG=XalanTransform - 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 "XalanTransform.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 "XalanTransform.mak" CFG="XalanTransform - Win32 Debug"
  !MESSAGE 
  !MESSAGE Possible choices for configuration are:
  !MESSAGE 
  !MESSAGE "XalanTransform - Win32 Release" (based on "Win32 (x86) Console Application")
  !MESSAGE "XalanTransform - 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)" == "XalanTransform - 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 "..\..\Build\Win32\VC6\Release"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Release\XalanTransform"
  # 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 /MD /W3 /GR /GX /O2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
  # ADD BASE RSC /l 0x409 /d "NDEBUG"
  # ADD RSC /l 0x409 /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 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Release\*.lib ..\..\Build\Win32\VC6\Release\*.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 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
  
  !ELSEIF  "$(CFG)" == "XalanTransform - 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 "..\..\Build\Win32\VC6\Debug"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Debug\XalanTransform"
  # 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 /GR /GX /ZI /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "XML_DEBUG" /YX /FD /GZ /c
  # ADD BASE RSC /l 0x409 /d "_DEBUG"
  # ADD RSC /l 0x409 /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 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Debug\*.lib ..\..\Build\Win32\VC6\Debug\*.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 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
  
  !ENDIF 
  
  # Begin Target
  
  # Name "XalanTransform - Win32 Release"
  # Name "XalanTransform - Win32 Debug"
  # Begin Group "Source Files"
  
  # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
  # Begin Source File
  
  SOURCE=.\XalanTransform.cpp
  # End Source File
  # End Group
  # Begin Group "Header Files"
  
  # PROP Default_Filter "h;hpp;hxx;hm;inl"
  # End Group
  # Begin Group "Resource Files"
  
  # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
  # End Group
  # End Target
  # End Project