Results 1 to 4 of 4

Thread: XML + XSLT mit QT

  1. #1
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default XML + XSLT mit QT

    Hey @all,

    I think i have somewhere read that XSLT isn't supported by QT at the moment.
    Currently I use QT 4.4 for Windows. My Problem now is to use WebView/WebKit.
    To work with XML and XSLT i decided to try Xerces-c and Xalan-c within my QT Project, but now I can't compile it.
    My Compiler is MinGW.

    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Tue Jun 10 10:37:08 2008
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. TARGET =
    7. win32 {
    8. DEPENDPATH += . \
    9. C:/xerces/xerces-c-windows_2000-msvc_60/include \
    10. C:/xalan/xalan-C_1_10_0-win32-msvc_60/include \
    11. C:/xerces/xerces-c-windows_2000-msvc_60/lib \
    12. C:/xalan/xalan-C_1_10_0-win32-msvc_60/lib \
    13. C:/Boost/lib
    14. INCLUDEPATH += . \
    15. C:/xerces/xerces-c-windows_2000-msvc_60/include \
    16. C:/xalan/xalan-C_1_10_0-win32-msvc_60/include \
    17. C:/Boost/include/boost-1_33_1
    18.  
    19. #win32:LIBS += -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -lxerces-c_2 -LC:\xalan\xalan-C_1_10_0-win32-msvc_60\lib -lXalan-C_1
    20. #LIBS += -lxerces-c_2.lib -lXalan-C_1.lib
    21. #win32:LIBS += C:/xerces/xerces-c-windows_2000-msvc_60/lib/xerces-c_2.lib \
    22. # C:/xalan/xalan-C_1_10_0-win32-msvc_60/lib/Xalan-C_1.lib
    23. LIBS += -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -LC:/xerces/xerces-c-windows_2000-msvc_60/lib -lxerces-c_2 -LC:/xalan/xalan-C_1_10_0-win32-msvc_60/lib -lXalan-C_1 \
    24. -LC:/Boost/lib -lboost_regex-mgw-1_33_1 -lboost_python-mgw-1_33_1
    25. }
    26. QT -= gui
    27. CONFIG += console
    28.  
    29. # Input
    30. HEADERS += xerces_strings.hpp
    31. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 
    When i try to compile i get the following error:
    C:\Documents and Settings\user\Desktop\XercesQTDemo>qmake && mingw32-make Release
    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory `C:/Documents and Settings/user/Desktop/XercesQTDemo'
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\4.4.0MinGW\include\QtCore" -I"..\..\..\..\Qt\4.4.0MinGW\include\QtCore" -I"..\..\..\..\Qt\4.4.0MinGW\include" -I"." -I"..\..\..\..\xerces\xerces-c-windows_2000-msvc_60\include" -I"..\..\..\..\xalan\xalan-C_1_10_0-win32-msvc_60\include" -I"..\..\..\..\Boost\include\boost-1_33_1" -I"..\..\..\..\Qt\4.4.0MinGW\include\ActiveQt" -I"release" -I"." -I"..\..\..\..\Qt\4.4.0MinGW\mkspecs\win32-g++" -o release\main.o main.cpp
    In file included from main.cpp:22:
    xerces_strings.hpp:25:46: warning: no newline at end of file
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o release\XercesQTDemo.exe release/main.o -L"c:\Qt\4.4.0MinGW\lib" -LC:\xerces\xerces-c-windows_2000-msvc_60\lib -LC:/xerces/xerces-c-windows_2000-msvc_60/lib -lxerces-c_2 -LC:/xalan/xalan-C_1_10_0-win32-msvc_60/lib -lXalan-C_1 -LC:/Boost/lib -lboost_regex-mgw-1_33_1 -lboost_python-mgw-1_33_1 -lQtCore4
    release/main.o:main.cpp:(.text+0x67): undefined reference to `_imp___ZN11xercesc_2_76XMLUni22fgXercescDefaultLo caleE'
    release/main.o:main.cpp:(.text+0x7e): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils10Initial izeEPKcS2_PNS_12PanicHandlerEPNS_13MemoryManagerEb '
    release/main.o:main.cpp:(.text+0x99): undefined reference to `_imp___ZN11xercesc_2_76XMLUni22fgXercescDefaultLo caleE'
    release/main.o:main.cpp:(.text+0xb0): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils10Initial izeEPKcS2_PNS_12PanicHandlerEPNS_13MemoryManagerEb '
    release/main.o:main.cpp:(.text+0xb5): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
    release/main.o:main.cpp:(.text+0xbd): undefined reference to `xalanc_1_10::XalanTransformer::initialize(xercesc _2_7::MemoryManager&)'
    release/main.o:main.cpp:(.text+0xcd): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
    release/main.o:main.cpp:(.text+0xdf): undefined reference to `xalanc_1_10::XalanTransformer::XalanTransformer(x ercesc_2_7::MemoryManager&)'
    release/main.o:main.cpp:(.text+0xef): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
    release/main.o:main.cpp:(.text+0x10a): undefined reference to `xalanc_1_10::XSLTInputSource::XSLTInputSource(cha r const*, xercesc_2_7::MemoryManager&)'
    release/main.o:main.cpp:(.text+0x11a): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
    release/main.o:main.cpp:(.text+0x135): undefined reference to `xalanc_1_10::XSLTInputSource::XSLTInputSource(cha r const*, xercesc_2_7::MemoryManager&)'
    release/main.o:main.cpp:(.text+0x145): undefined reference to `xalanc_1_10::XalanMemMgrs::getDefaultXercesMemMgr ()'
    release/main.o:main.cpp:(.text+0x160): undefined reference to `xalanc_1_10::XSLTResultTarget::XSLTResultTarget(c har const*, xercesc_2_7::MemoryManager&)'
    release/main.o:main.cpp:(.text+0x197): undefined reference to `xalanc_1_10::XalanTransformer::transform(xalanc_1 _10::XSLTInputSource const&, xalanc_1_10::XSLTInputSource const&, xalanc_1_10::XSLTResultTarget const&)'
    release/main.o:main.cpp:(.text+0x258): undefined reference to `xalanc_1_10::XSLTResultTarget::~XSLTResultTarget( )'
    release/main.o:main.cpp:(.text+0x263): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
    release/main.o:main.cpp:(.text+0x26d): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
    release/main.o:main.cpp:(.text+0x286): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
    release/main.o:main.cpp:(.text+0x290): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
    release/main.o:main.cpp:(.text+0x2b4): undefined reference to `xalanc_1_10::XalanTransformer::~XalanTransformer( )'
    release/main.o:main.cpp:(.text+0x2c1): undefined reference to `xalanc_1_10::XalanTransformer::terminate()'
    release/main.o:main.cpp:(.text+0x2c7): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils9Terminat eEv'
    release/main.o:main.cpp:(.text+0x3fe): undefined reference to `xalanc_1_10::XSLTResultTarget::~XSLTResultTarget( )'
    release/main.o:main.cpp:(.text+0x409): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
    release/main.o:main.cpp:(.text+0x416): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
    release/main.o:main.cpp:(.text+0x42f): undefined reference to `vtable for xalanc_1_10::XSLTInputSource'
    release/main.o:main.cpp:(.text+0x43c): undefined reference to `_imp___ZN11xercesc_2_711InputSourceD2Ev'
    release/main.o:main.cpp:(.text+0x463): undefined reference to `xalanc_1_10::XalanTransformer::~XalanTransformer( )'
    release/main.o:main.cpp:(.text+0x473): undefined reference to `xalanc_1_10::XalanTransformer::terminate()'
    release/main.o:main.cpp:(.text+0x479): undefined reference to `_imp___ZN11xercesc_2_716XMLPlatformUtils9Terminat eEv'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release\XercesQTDemo.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/user/Desktop/XercesQTDemo'
    mingw32-make: *** [Release] Error 2

    C:\Documents and Settings\user\Desktop\XercesQTDemo>
    I hope somebody can help me, here is also the demofile (main.cpp)
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <iostream>
    3.  
    4. #include <xalanc/Include/PlatformDefinitions.hpp>
    5. #include <xalanc/XalanTransformer/XalanTransformer.hpp>
    6. #include <xalanc/XSLT/XSLTInputSource.hpp>
    7. #include <xalanc/XSLT/XSLTResultTarget.hpp>
    8. #include <xercesc/util/PlatformUtils.hpp>
    9.  
    10. #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__)
    11. #if defined(_DEBUG)
    12. //#pragma comment(linker, "/NODEFAULTLIB:libcmt.lib")
    13. #pragma comment(lib, "xerces-c_2D.lib")
    14. //#pragma comment(lib, "xerces-depdom_2D.lib")
    15. #pragma comment(lib, "Xalan-C_1D.lib")
    16. #elif defined(NDEBUG)
    17. #pragma comment(lib, "xerces-c_2.lib")
    18. //#pragma comment(lib, "xerces-depdom_2.lib")
    19. #pragma comment(lib, "Xalan-C_1.lib")
    20. #endif
    21. #endif
    22. #include "xerces_strings.hpp" // Example 14-4
    23.  
    24. using namespace std;
    25. using namespace xercesc;
    26. using namespace xalanc;
    27.  
    28. // RAII utility that initializes the parser and frees resources
    29. // when it goes out of scope
    30. struct XalanInitializer {
    31. XalanInitializer( )
    32. {
    33. XMLPlatformUtils::Initialize( );
    34. XalanTransformer::initialize( );
    35. }
    36. ~XalanInitializer( )
    37. {
    38. XalanTransformer::terminate( );
    39. XMLPlatformUtils::Terminate( );
    40. }
    41. };
    42.  
    43. int main(int argc, char* argv[]) {
    44. try {
    45. XMLPlatformUtils::Initialize();
    46. XalanInitializer init; // Initialize Xalan.
    47. XalanTransformer xslt; // XSLT engine.
    48. XSLTInputSource xml("report.xml"); // XML document from
    49. // Example 14-1.
    50. XSLTInputSource xsl("report.xsl"); // Stylesheet from
    51. // Example 14-19.
    52. XSLTResultTarget html("report.html"); // xslt's output.
    53.  
    54. Perform transformation.
    55. if (xslt.transform(xml, xsl, html) != 0) {
    56. cout << "xml error: " << xslt.getLastError( ) << "\n";
    57. }
    58. }
    59. catch (const XMLException& e) {
    60. // cout << "xml error: " << toNative(e.getMessage( )) << "\n";
    61. return EXIT_FAILURE;
    62. }
    63. catch (const exception& e) {
    64. cout << e.what( ) << "\n";
    65. return EXIT_FAILURE;
    66. }
    67. return 0;
    68. }
    To copy to clipboard, switch view to plain text mode 
    Regards NoRulez
    Last edited by jacek; 11th June 2008 at 00:02. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: XML + XSLT mit QT

    Are you sure that those libraries were compiled for MinGW? There's "msvc_60" at the end of directory names.

  3. #3
    Join Date
    Apr 2008
    Posts
    196
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    1

    Default Re: XML + XSLT mit QT

    For xerces as an example I can only download the following sources:
    Qt Code:
    1. xerces-c_2_8_0-x86-windows-vc_7_1.zip [PGP] [MD5]
    2. xerces-c_2_8_0-x86-windows-vc_8_0.zip [PGP] [MD5]
    3. xerces-c_2_8_0-x86-linux-gcc_3_4.tar.gz [PGP] [MD5]
    4. xerces-c_2_8_0-x86-solaris-gcc_3_4.tar.gz [PGP] [MD5]
    5. xerces-c_2_8_0-x86-solaris-cc_5_7.tar.gz [PGP] [MD5]
    6. xerces-c_2_8_0-sparc-solaris-gcc_3_4.tar.gz [PGP] [MD5]
    7. xerces-c_2_8_0-sparc-solaris-cc_5_7.tar.gz [PGP] [MD5]
    8. xerces-c_2_8_0-powerpc-aix-xlc_7_0.tar.gz [PGP] [MD5]
    9. xerces-c_2_8_0-hppa-hpux-acc_3.tar.gz [PGP] [MD5]
    10. xerces-c_2_8_0-hppa-hpux-acc_3_AA.tar.gz [PGP] [MD5]
    11. xerces-c_2_8_0-ia64-hpux-acc_6.tar.gz [PGP] [MD5]
    12. xerces-c_2_8_0-x86-macosx-gcc_4_0.tar.gz [PGP] [MD5]
    13. xerces-c_2_8_0-powerpc-macosx-gcc_4_0.tar.gz [PGP] [MD5]
    To copy to clipboard, switch view to plain text mode 
    Can I also use linux-gcc_3_4 for MinGW?

    Regards NoRulez

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: XML + XSLT mit QT

    Quote Originally Posted by NoRulez View Post
    Can I also use linux-gcc_3_4 for MinGW?
    I've never used xerces-c with MinGW, but I think you should try to compile it from sources.

    See this: http://xerces.apache.org/xerces-c/bu...nix.html#MinGW

Similar Threads

  1. QT4 DomXPath / DomElementContainer find tag.
    By patrik08 in forum Qt Programming
    Replies: 20
    Last Post: 24th June 2007, 13:23
  2. A sample XSLT transformation from Qt rich text to XHTML
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2006, 18:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.