given your advice xerces message is all gone, now i am facing another message, sorry if bothering, i am to try to compile this tutorial: http://vichargrave.com/xml-parsing-with-dom-using-c/ wich has main.cpp, XmlDomDocument.cpp and XmlDomDocument.h.
*main.cpp* #include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include "XmlDomDocument.h" int main(int argc, char** argv) { string value; XmlDomDocument* doc = new XmlDomDocument("./bookstore.xml"); if (doc) { for (int i = 0; i < doc ->getChildCount("bookstore", 0, "book"); i++) { printf("Book %d\n", i+1); value = doc->getAttributeValue("book", i, "category"); printf("book category - %s\n", value.c_str()); value = doc->getChildValue("book", i, "title"); printf("book title - %s\n", value.c_str()); value = doc-> getChildValue("book", i, "author"); printf("book author - %s\n", value. c_str()); value = doc->getChildValue("book", i, "year"); printf("book year - %s\n", value.c_str()); value = doc->getChildValue("book", i, "price" ); printf("book price - %s\n", value.c_str()); } delete doc; } *XmlDomDocument.h* #ifndef __XmlDomDocument_h__ #define __XmlDomDocument_h__ #include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/dom/DOM.hpp> #include <xercesc/sax/HandlerBase.hpp> #include <xercesc/util/XMLString.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <string> using namespace std; using namespace xercesc; class XmlDomDocument { DOMDocument* m_doc; public: XmlDomDocument(const char* xmlfile); ~XmlDomDocument(); string getChildValue(const char* parentTag, int parentIndex, const char* childTag, int childIndex=0); string getAttributeValue(const char* elementTag, int elementIndex, const char* attrTag); int getRootElementCount (const char* rootElementTag); int getChildCount(const char* parentTag, int parentIndex, const char* childTag); private: XmlDomDocument(); XmlDomDocument(const XmlDomDocument&); }; *XmlDomDocument.cpp* class XmlDomErrorHandler : public HandlerBase { public: void fatalError( const SAXParseException &exc) { printf("Fatal parsing error at line %d\n", (int)exc.getLineNumber()); exit(-1); } }; XercesDOMParser* parser = NULL; ErrorHandler* errorHandler = NULL; void createParser() { if (!parser) { XMLPlatformUtils::Initialize(); parser = new XercesDOMParser(); errorHandler = (ErrorHandler*) new XmlDomErrorHandler(); parser->setErrorHandler(errorHandler); } } XmlDomDocument::XmlDomDocument(const char* xmlfile) : m_doc(NULL) { createParser(); parser->parse(xmlfile); m_doc = parser->adoptDocument(); } XmlDomDocument::~XmlDomDocument() { if (m_doc) m_doc->release(); } string XmlDomDocument::getChildValue(const char* parentTag, int parentIndex , const char* childTag, int childIndex) { XMLCh* temp = XMLString:: transcode(parentTag); DOMNodeList* list = m_doc->getElementsByTagName(temp ); XMLString::release(&temp); DOMElement* parent = dynamic_cast<DOMElement*>(list->item(parentIndex)); DOMElement* child = dynamic_cast<DOMElement*>(parent->getElementsByTagName (XMLString::transcode(childTag))->item(childIndex)); string value; if ( child) { char* temp2 = XMLString::transcode(child->getTextContent()); value = temp2; XMLString::release(&temp2); } else { value = ""; } return value; } string XmlDomDocument::getAttributeValue(const char* elementTag, int elementIndex, const char* attributeTag) { XMLCh* temp = XMLString:: transcode(elementTag); DOMNodeList* list = m_doc->getElementsByTagName(temp ); XMLString::release(&temp); DOMElement* element = dynamic_cast<DOMElement*>(list->item(elementIndex)); temp = XMLString::transcode(attributeTag); char* temp2 = XMLString:: transcode(element->getAttribute(temp)); string value = temp2; XMLString::release(&temp); XMLString::release(& temp2); return value; } int XmlDomDocument::getRootElementCount(const char* rootElementTag) { DOMNodeList* list = m_doc->getElementsByTagName(XMLString::transcode( rootElementTag)); return (int)list->getLength(); } int XmlDomDocument::getChildCount(const char* parentTag, int parentIndex, const char* childTag) { XMLCh* temp = XMLString::transcode(parentTag); DOMNodeList* list = m_doc->getElementsByTagName(temp); XMLString::release(& temp); DOMElement* parent = dynamic_cast<DOMElement*>(list->item(parentIndex)); DOMNodeList* childList = parent->getElementsByTagName(XMLString::transcode( childTag)); return (int)childList->getLength(); } *and my makefile is* ARM_PREFIX= arm-linux-gnueabihf- CC = $(ARM_PREFIX)g++ SRC += gtktest.c TARGET = gtktest LIBRARY += gtk-3 LIBRARY += gdk-3 LIBRARY += atk-1.0 LIBRARY += gio-2.0 LIBRARY += pangocairo-1.0 LIBRARY += gdk_pixbuf-2.0 LIBRARY += cairo-gobject LIBRARY += pango-1.0 LIBRARY += cairo LIBRARY += gobject-2.0 LIBRARY += glib-2.0 LIBRARY += xerces-c-3.1 LIBRARYDIR += $(HOME)/rpi/lib/arm-linux- gnueabihf LIBRARYDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf LIBRARYDIR += $(HOME)/rpi/lib LIBRARYDIR += $(HOME)/rpi/usr/lib LIBRARYDIR += $(HOME)/rpi/usr/local/lib LIBRARYDIR += $(HOME)/rpi/usr/include XLINK_LIBDIR += $(HOME)/rpi/lib/arm-linux-gnueabihf XLINK_LIBDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf INCLUDEDIR += $(HOME)/rpi/usr/include/gtk-3.0 INCLUDEDIR += $(HOME)/rpi/usr/include/pango-1.0 INCLUDEDIR += $(HOME)/rpi/usr/include/gio-unix-2.0/ INCLUDEDIR += $(HOME)/rpi/usr/include/atk-1.0 INCLUDEDIR += $(HOME)/rpi/usr/include/cairo INCLUDEDIR += $(HOME)/rpi/usr/include/gdk-pixbuf-2.0 INCLUDEDIR += $(HOME)/rpi/usr/include/freetype2 INCLUDEDIR += $(HOME)/rpi/usr/include/glib-2.0 INCLUDEDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf/glib-2.0/include INCLUDEDIR += $(HOME)/rpi/usr/include/pixman-1 INCLUDEDIR += $(HOME)/rpi/usr/include/libpng12 INCLUDEDIR += $(HOME)/rpi/usr/local/lib INCLUDEDIR += $(HOME)/rpi/usr/include/xercesc OPT = -O0 DEBUG = -g WARN= -Wall PTHREAD= -pthread INCDIR = $(patsubst %,-I%,$(INCLUDEDIR)) LIBDIR = $(patsubst %,-L%,$(LIBRARYDIR)) LIB = $(patsubst %,-l%,$(LIBRARY)) XLINKDIR = $(patsubst %,-Xlinker -rpath-link=%,$(XLINK_LIBDIR)) all: $(CC) $(OPT) $(DEBUG) $(WARN) $(LIBDIR) $(PTHREAD) $(INCDIR) $(XLINKDIR) $(LIB) $(SRC) -o $(TARGET) clean: rm -rf $(TARGET) when i run make it say : undefined reference to 'XmlDomDocument:: XmlDomDocument(char const*)' undefined reference to 'XmlDomDocument:: getAttributeValue(char const*, int, char const)' undefined reference to 'XmlDomDocument:: getChildValue(char const*, int, char const)' etc sorry if bothering or out of scope On Sat, Aug 23, 2014 at 11:30 AM, Alberto Massari <albertomass...@tiscali.it > wrote: > Il 23/08/14 14:10, milton ortiz ha scritto: > > actually alberto i am not a programmer, i am trying to put pieces together >> but you were absolute right, it was a trouble related to the path you >> told, >> so, if i follow what you said i could delete: >> >> INCLUDEDIR += $(HOME)/rpi/usr/include/gtk-3.0 >> INCLUDEDIR += $(HOME)/rpi/usr/include/pango-1.0 >> INCLUDEDIR += $(HOME)/rpi/usr/include/gio-unix-2.0/ >> INCLUDEDIR += $(HOME)/rpi/usr/include/atk-1.0 >> INCLUDEDIR += $(HOME)/rpi/usr/include/cairo >> INCLUDEDIR += $(HOME)/rpi/usr/include/gdk-pixbuf-2.0 >> INCLUDEDIR += $(HOME)/rpi/usr/include/freetype2 >> INCLUDEDIR += $(HOME)/rpi/usr/include/glib-2.0 >> >> they are all in the include directory, right? >> thanks a lot for your guide >> > > No, I don't think those libraries hardcode the version number in their > #include statement. Maybe "cairo" could be removed... but it's better if > you just replace > > INCLUDEDIR += $(HOME)/rpi/usr/include/xercesc > > with > > INCLUDEDIR += $(HOME)/rpi/usr/include > > > and try to compile > > Alberto > > > >> >> On Sat, Aug 23, 2014 at 4:16 AM, Alberto Massari < >> albertomass...@tiscali.it> >> wrote: >> >> Xerces-C++ assumes that its include files are located in a 'xercesc' >>> subdirectory of the include path. You are specifying >>> >>> INCLUDEDIR += $(HOME)/rpi/usr/include/xercesc >>> >>> So, unless in the xercesc there is another xercesc subfolder, you should >>> really have >>> >>> INCLUDEDIR += $(HOME)/rpi/usr/include >>> >>> >>> Also, why do you have the LIBRARYDIR pointing to the include folder? >>> >>> LIBRARYDIR += $(HOME)/rpi/usr/include >>> >>> >>> Alberto >>> >>> Il 23/08/14 03:27, joselalupa ha scritto: >>> >>> >>> i am trying to do a cross compile of xerces in ubuntu for arm >>>> processor, i >>>> have followed this tutorial >>>> (http://hertaville.com/2013/07/19/cross-compiling-gtk- >>>> applications-for-the-raspberry-pi/) >>>> it works fine with gtk but when trying to call xerces i got error: >>>> "c:5:42: >>>> fatal error: xercesc/util/PlatformUtils.hpp: no such files or >>>> directory." >>>> xerces library is in /rpi/usr/lib/arm-linux-gnueabihf/ >>>> libxerces-c-3.1.so >>>> , >>>> the other files are in /rpi/usr/include/xercesc. i can see the file is >>>> the >>>> route the makefile is pointing, here is my makefiles code: >>>> >>>> ARM_PREFIX= arm-linux-gnueabihf- >>>> CC = $(ARM_PREFIX)g++ >>>> SRC += gtktest.c >>>> TARGET = gtktest >>>> >>>> LIBRARY += gtk-3 >>>> LIBRARY += gdk-3 >>>> LIBRARY += atk-1.0 >>>> LIBRARY += gio-2.0 >>>> LIBRARY += pangocairo-1.0 >>>> LIBRARY += gdk_pixbuf-2.0 >>>> LIBRARY += cairo-gobject >>>> LIBRARY += pango-1.0 >>>> LIBRARY += cairo >>>> LIBRARY += gobject-2.0 >>>> LIBRARY += glib-2.0 >>>> LIBRARY += xerces-c-3.1 >>>> >>>> LIBRARYDIR += $(HOME)/rpi/lib/arm-linux-gnueabihf >>>> LIBRARYDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf >>>> LIBRARYDIR += $(HOME)/rpi/lib >>>> LIBRARYDIR += $(HOME)/rpi/usr/lib >>>> LIBRARYDIR += $(HOME)/rpi/usr/local/lib >>>> LIBRARYDIR += $(HOME)/rpi/usr/include >>>> >>>> XLINK_LIBDIR += $(HOME)/rpi/lib/arm-linux-gnueabihf >>>> XLINK_LIBDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf >>>> >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/gtk-3.0 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/pango-1.0 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/gio-unix-2.0/ >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/atk-1.0 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/cairo >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/gdk-pixbuf-2.0 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/freetype2 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/glib-2.0 >>>> INCLUDEDIR += $(HOME)/rpi/usr/lib/arm-linux-gnueabihf/glib-2.0/include >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/pixman-1 >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/libpng12 >>>> INCLUDEDIR += $(HOME)/rpi/usr/local/lib >>>> INCLUDEDIR += $(HOME)/rpi/usr/include/xercesc >>>> >>>> OPT = -O0 >>>> DEBUG = -g >>>> WARN= -Wall >>>> PTHREAD= -pthread >>>> >>>> INCDIR = $(patsubst %,-I%,$(INCLUDEDIR)) >>>> LIBDIR = $(patsubst %,-L%,$(LIBRARYDIR)) >>>> LIB = $(patsubst %,-l%,$(LIBRARY)) >>>> XLINKDIR = $(patsubst %,-Xlinker -rpath-link=%,$(XLINK_LIBDIR)) >>>> >>>> all: >>>> $(CC) $(OPT) $(DEBUG) $(WARN) $(LIBDIR) $(PTHREAD) $(INCDIR) $(XLINKDIR) >>>> $(LIB) $(SRC) -o $(TARGET) >>>> >>>> clean: >>>> rm -rf $(TARGET) >>>> >>>> any help is welcome >>>> >>>> >>>> >>>> >>>> -- >>>> View this message in context: http://apache-xml-project. >>>> 6118.n7.nabble.com/cross-compiling-xerces-project-tp41413.html >>>> Sent from the Xerces - C - Users mailing list archive at Nabble.com. >>>> >>>> >>>> >> > -- ----------------------------------------------------- Inventando cositas pa hacer que las masas reaccionen.