0

Possible Duplicate:
Are there general guidlines for solving undefined reference/unresolved symbol issues?

I want to transform an xml to insert sql statements. I have ready the xml and xslt files and I know that transformation runs ok (tested with Oxygen).

Now, I'm coding this transformation with c++ unsuccessfully.

I have tried to include this libraries:

#include <libxml2/libxml/xmlversion.h>
#include <libxml2/libxml/parser.h>
#include <libxml2/libxml/valid.h>
#include <libxml2/libxml/xmlschemastypes.h>
#include <libxml2/libxml/xmlschemas.h>
#include <libxml2/libxml/xmlmemory.h>
#include <libxml2/libxml/debugXML.h>
#include <libxml2/libxml/HTMLtree.h>
#include <libxml2/libxml/xmlIO.h>
#include <libxml2/libxml/DOCBparser.h>
#include <libxml2/libxml/xinclude.h>
#include <libxml2/libxml/catalog.h>
#include <xalanc/Include/PlatformDefinitions.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xalanc/XalanTransformer/XalanTransformer.hpp>

but compiler show me a lot of errors in code like:

/home/kimpa2007/xml/src/main.cc:108: undefined reference to `xercesc_2_8::XMLUni::fgXercescDefaultLocale'

/home/kimpa2007/xml/src/main.cc:109: undefined reference to `xalanc_1_10::XalanTransformer::initialize(xercesc_2_8::MemoryManager&)'

Some one can explain how to code this transformation in a siple way?

Community
  • 1
  • 1
kimpa2007
  • 25
  • 6
  • Thanks but I'm not interested about fix the "undefined reference" problem. I just want to need a simple way to make the transformation. – kimpa2007 Jan 10 '13 at 19:14
  • XSLT is as good a method as any to transform XML. – cppguy Jan 10 '13 at 19:52
  • See also: http://en.wikipedia.org/wiki/Extract,_transform,_load and http://kettle.pentaho.com/. Why are you reinventing the wheel? – Dave Jarvis Jan 10 '13 at 23:37

1 Answers1

2

They are several ways to make XSL transformation, see Process an XML document using an XSLT stylesheet micro howto:

  • xsltproc
  • Xalan
  • SaxonB
  • Saxon6

I see that you are intended to use Xalan. Perhaps this is actually the right way. Notice that this library needs to be configured. You can get help to configure it on Xayno90 post. I copy-paste here steps:

I finally managed to compile and install Xerces and Xalan together for Ubuntu 10.04, do as follows:

step 1

sudo apt-get source libxerces-c28
sudo apt-get source libxalan110

step 2.

add "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH" to /etc/ld.so.conf

step 3.

you may need to change owner of source packages from root to normal user

step 4. Build Xerces

export XERCESCROOT=/home/user/xerces-c2-2.8.0+deb1
cd $XERCESCROOT
cd src/xercesc
./runConfigure -plinux -cgcc -xg++ -minmem -nsocket -rpthread -b64 -P /usr/local
make
sudo XERCESCROOT=$XERCESCROOT make install

step 5. Build Xalan

export XERCESCROOT=/usr/local
cd $XERCESCROOT
/usr/local$ cd ~
export XERCESCROOT=/home/user/xerces-c2-2.8.0+deb1
cd $XERCESCROOT
cd ~
export XALANCROOT=/home/user/xalan-1.10/c
cd $XALANCROOT
./runConfigure -p linux -c gcc -x g++ -b64 -P /usr/local
make
sudo XALANCROOT=$XALANCROOT make install

step 6.

Check the directories of /usr/local/lib and /usr/local/include to confirm the both Xerces and Xalan are both installed

The needs to be a wiki for a Ubuntu specific install of these XML libraries and packages as there is no definitive guide for this currently plus the install methods for other OS had to be interpreted in order to fit this installation.

Also:

Finally, read this SO posts:

Community
  • 1
  • 1
dani herrera
  • 48,760
  • 8
  • 117
  • 177