C function use to read & write an XML file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jinendrashankar
    New Member
    • Nov 2007
    • 10

    C function use to read & write an XML file

    i am getting following error in my code
    help me to slove this issue
    $ gcc -Wall -g -I/usr/include/libxml2/libxml -c create_xml.c
    In file included from create_xml.c:2:
    /usr/include/libxml2/libxml/tree.h:20:31: libxml/xmlversion.h: No such file or directory
    /usr/include/libxml2/libxml/tree.h:880:30: libxml/xmlmemory.h: No such file or directory
    In file included from create_xml.c:3:
    /usr/include/libxml2/libxml/parser.h:12:25: libxml/tree.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:13:26: libxml/valid.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:14:29: libxml/entities.h: No such file or directory
    In file included from create_xml.c:3:
    /usr/include/libxml2/libxml/parser.h:182: error: parse error before "xmlValidCt xt"
    /usr/include/libxml2/libxml/parser.h:182: warning: no semicolon at end of struct or union
    /usr/include/libxml2/libxml/parser.h:222: error: parse error before '}' token
    /usr/include/libxml2/libxml/parser.h:647:29 : libxml/encoding.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:648:26 : libxml/xmlIO.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:649:28 : libxml/globals.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:763: error: parse error before "xmlCharEncodin g"
    /usr/include/libxml2/libxml/parser.h:825: error: parse error before "xmlInputReadCa llback"
    /usr/include/libxml2/libxml/parser.h:832: error: parse error before "xmlCharEncodin g"
    create_xml.c: In function `main':
    create_xml.c:11 : error: structure has no member named `root'
    create_xml.c:12 : error: structure has no member named `root'
    create_xml.c:13 : error: structure has no member named `root'
    create_xml.c:14 : error: structure has no member named `root'
    create_xml.c:16 : error: structure has no member named `root'
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by jinendrashankar
    i am getting following error in my code
    help me to slove this issue
    $ gcc -Wall -g -I/usr/include/libxml2/libxml -c create_xml.c
    In file included from create_xml.c:2:
    /usr/include/libxml2/libxml/tree.h:20:31: libxml/xmlversion.h: No such file or directory
    /usr/include/libxml2/libxml/tree.h:880:30: libxml/xmlmemory.h: No such file or directory
    In file included from create_xml.c:3:
    /usr/include/libxml2/libxml/parser.h:12:25: libxml/tree.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:13:26: libxml/valid.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:14:29: libxml/entities.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:647:29 : libxml/encoding.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:648:26 : libxml/xmlIO.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:649:28 : libxml/globals.h: No such file or directory
    /usr/include/libxml2/libxml/parser.h:763: error: parse error before "xmlCharEncodin g"
    /usr/include/libxml2/libxml/parser.h:825: error: parse error before "xmlInputReadCa llback"
    /usr/include/libxml2/libxml/parser.h:832: error: parse error before "xmlCharEncodin g"
    Looks like it can't find several of the files you attempted to include in your program on your machine.
    Originally posted by jinendrashankar
    In file included from create_xml.c:3:
    /usr/include/libxml2/libxml/parser.h:182: error: parse error before "xmlValidCt xt"
    /usr/include/libxml2/libxml/parser.h:182: warning: no semicolon at end of struct or union
    I think the second message is really self-explanatory.
    Originally posted by jinendrashankar
    create_xml.c: In function `main':
    create_xml.c:11 : error: structure has no member named `root'
    create_xml.c:12 : error: structure has no member named `root'
    create_xml.c:13 : error: structure has no member named `root'
    create_xml.c:14 : error: structure has no member named `root'
    create_xml.c:16 : error: structure has no member named `root'
    I'm betting this 'root' object is trying to use some of the libraries above, but it might just be improperly instantiated. Some code would have been helpful there.

    Comment

    • sicarie
      Recognized Expert Specialist
      • Nov 2006
      • 4677

      #3
      jinendrashankar-

      Please check your Private Messages, accessible through the PMs link on the top right corner of the page.

      Comment

      • jinendrashankar
        New Member
        • Nov 2007
        • 10

        #4
        Hi All,

        Check this code its use to read XML data from XML file. try this code in your local system with command

        cc create_xml.c -o create_xml -I/usr/include/libxml2 -L/usr/lib -R/usr/lib -lxml2 -lz -lpthread -lm -lsocket -lnsl

        its create your EXE create_xml in local then run
        ./create_xml <file.xml>

        Comment

        Working...