Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   XML Parsing Using libXML2 (http://www.go4expert.com/forums/xml-parsing-using-libxml2-t16657/)

debapriya.patra 25Mar2009 13:01

XML Parsing Using libXML2
 
Hi All,

I am really new to C++ language. I wanted to write a small program in C++ using libxml2.
Can anyone help me in this.I am really helpless..i mean i am unable to proceed, not even getting any help on this.

My requirement is to parse a string content using libxml2...that string content is nothing but the xml content as string.

thnaks in advance

Regards,
Deba

alwaysLearning 27Mar2009 17:55

Re: XML Parsing Using libXML2
 
Hi,

what type of help you are asking?
There are lots of online tutorial about persing xml.
First link found in google search for libxml2 is quite usefull.

http://www.xmlsoft.org/tutorial/index.html

Regards,

Shaikat

debapriya.patra 2Apr2009 14:27

Re: XML Parsing Using libXML2
 
Hi ,

Sorry to say that i am really confused with that site and whtever example is der..
I really wanted something which i am not getting der....


If you can help me on this then it will be good.
Like i wanted to parse one XML string and get the values from the nodes using libxml2.

Really i need help...Frankly speaking i don't know anything about C++ .and the biggest problem is i don't how to use third party library like "libxml2"..I used to put the jars in our class path for java but here how do i do that....


So hope anyone can help me in all this problems..


Regards,
Deba

alwaysLearning 2Apr2009 14:47

Re: XML Parsing Using libXML2
 
Hi Deba,

First make sure you have installed libxml2.
you should see a libxl2.so file ( so is a library file in linux like jar) in /usr/lib

then while compile do this:

g++ test.cpp -o test -lxml2

notice the -lxml2 which includes the library while compiling.


Go step by step.
First try to create an xml doc.
Then try to create element for xml doc.
Then try to add attribute to xml doc.
Then dump it in a buffer.
Then try to parse that buffer.
Up to this:
Follow this thread: http://www.go4expert.com/showthread.php?t=16761

Now when you are done, let me know i will try to give you a code for persing.

debapriya.patra 2Apr2009 18:10

Re: XML Parsing Using libXML2
 
Hi Shaikat,

Many Many thanks for ur response..I am really very very happy ..
Anyway i think u told me for the Linux environment but i am working only in windows and our development is on windows only.And i am using VC++ 6 and eclipse also for development.

And I have downloaded below things:
1)libxml2-2.7.3.win32.zip
2)iconv-1.9.2.win32.zip
3)libxmlsec-1.2.11+.win32.zip
4)libxslt-1.1.24.win32.zip

Because as per the instruction i need all these supported libraries for to work with libxml2 so i have downloaded.And according to the information i unziped all this and copied all the .lib files and .exe files from these folders into one folder and set the path to that folder .


And Now i wanted to know whatever i did is correct or wrong for windows environment.IF not correct then wht i need to do.
And another thing is i dont want to create the xml i have one string which is nothing but xml content.I just wanted to parse that string xml and get the values from the nodes .


Please guide me..i really need ur help to do this.


Regards
Deba

debapriya.patra 2Apr2009 18:12

Re: XML Parsing Using libXML2
 
Sorry one mistake i did in my previous reply..instead of writing .dll and .exe , i wrote .lib and .exe

sorry for that....

alwaysLearning 2Apr2009 19:24

Re: XML Parsing Using libXML2
 
Hi,

I am mainly a linux guy, so i wont be that helpful for windows.

but here is a good link to include dll in a vc++ 6

http://www.codeproject.com/KB/DLL/XDllPt1.aspx

the general examples which i gave on the other thread should also work fine under windows.

debapriya.patra 3Apr2009 09:17

Re: XML Parsing Using libXML2
 
Hi,

Thanks a lot for that link.That link is really help full for me. And i am able to link the libraries which i have downloaded.

Even though you are working on Linux only difference will be the way you are writing the code and the way you are compiling the code.

But you can give me a sample code using libxml2 which will parse an xml string. I mean the String is nothing but the xml content.

And i will try that code in windows and see the result...


Please help and on this.


Regards
Deba


All times are GMT +5.5. The time now is 20:55.