Thread: Unsure where I'm going wrong? mini xml install and usage
if can me or let me know should repost question, appreciative. thanks.
developing application.... call myapplication. started input , parse text cfg file manually in ansi c. started getting clever txt version of config file using keywords , trying read in , parse data needed each table char arrays. started thinking xml lot easier , since need anyhow dropped effort reading in data formatted txt file , have spent on 2 days trying ansi c compatible version of xml (called mini-xml) running on ubuntu can use xml functions "myapplication" read in xml file. not going well. think both unfamiliarity linux , lack of set of instructions mini-xml installation/build holding me back. thinkmy lackof knowledge on how linux features/additions integrated each other real issue here.
in short, not know steps need use mini-xml.
not know:
- install, build/make, or output of such actions put files
- take these files , place them in order able include mxml.h file "myapplication" , use.
goal: use fns in mini-xml api such
minixmldoc
createelement
getelement
fromfile
etc...
how directory structure looks on ubuntu:
ubundurp\
myapplication
ccu5
mini-xml
here instructions come mini-xml: (see comments in capital below username "ubundurp" preceding)
readme - 2009-05-17
-------------------
introduction
readme file describes mini-xml library version 2.6.
mini-xml small xml parsing library can use read xml and
xml-like data files in application without requiring large non-standard
libraries. mini-xml requires ansi c compatible compiler (gcc works,
vendors' ansi c compilers) , "make" program.
mini-xml provides following functionality:
- reading of utf-8 , utf-16 , writing of utf-8 encoded xml files and
strings.
- data stored in linked-list tree structure, preserving xml
data hierarchy.
- supports arbitrary element names, attributes, , attribute values
no preset limits, available memory.
- supports integer, real, opaque ("cdata"), , text data types in
"leaf" nodes.
- functions creating , managing trees of data.
- "find" , "walk" functions locating , navigating trees
of data.
mini-xml doesn't validation or other types of processing on data
based upon schema files or other sources of definition information.
building mini-xml
mini-xml comes autoconf-based configure script; type the
following command things going:
./configure (ubundurp: worked after removed windows style linefeed/carriage return)
default install prefix /usr/local, can overridden using the
--prefix option:
./configure --prefix=/foo
other configure options can found using --help option:
./configure --help
once have configured software, type "make" build , run
test program verify things working, follows:
make (ubundurp: seems have worked not of tests run passed. failed. think @ point i'm either trying access feature of linux either not installed or not available/visible me within mini-xml files structure)
if using mini-xml under microsoft windows visual c++ 2008, use
included project files in "vcnet" subdirectory build library
instead.
installing mini-xml
"install" target install mini-xml in lib , include
directories:
make install (ubundurp: seemed work since have bunch of .o type files in mini-xml directory)
once have installed it, use "-lmxml" option link application
against it.
(ubundurp: cannot seem work in make file when add option existing line in "myapplication"s make file.
$(target): $(cobjs)
$(cc) $(cflags) -o $@ $(cobjs) $(ldflags) -lnsl -lrt -lpthread -lmxml $(extra_libs) (unundurp: <- fails , says "cannot find -lmxml")
under impression -lmxml optional directive compiler. here seems wherever have lmxml directive defined not in scope of application developing. not know part(s) of mini-xml package need pull application folders. '.o' files? of code files? .lib file? everything? know these aren't fair questions, figured if explained issue, might have lead can follow. if so, maybe it'll me out of being stuck now. )
documentation
documentation available in "doc" subdirectory in files
"mxml.html" (html) , "mxml.pdf" (pdf). can @ the
"testmxml.c" , "mxmldoc.c" source files examples of using mini-xml.
mini-xml provides single header file include:
#include <mxml.h>
nodes defined "mxml_node_t" structure; "type" member defines
node type (element, integer, opaque, real, or text) determines
value want @ in "value" union. new nodes can be
created using "mxmlnewelement()", "mxmlnewinteger()", "mxmlnewopaque()",
"mxmlnewreal()", , "mxmlnewtext()" functions. elements can have
child nodes, , top node must element, "?xml".
load xml file using "mxmlloadfile()" function:
file *fp;
mxml_node_t *tree;
fp = fopen("filename.xml", "r");
tree = mxmlloadfile(null, fp, mxml_no_callback);
fclose(fp);
(unundurp: code snipppet trying work. fails during make saying "underfined reference 'mxmlloadfile' " makes sense because if put mxml.h file application folder, defenition of fn extern. extern where?
i haven't used mini xml before, installed it, , got little program build. didn't fetch source code, did, installed synaptic package manager, can't answer questions of yours. if don't have particular reason building yourself, suggest give , fetch repositories instead.
complete program looks this:
and build command:code:#include <stdio.h> #include <mxml.h> int main() { file *fp; mxml_node_t *tree; fp = fopen("filename.xml", "r"); tree = mxmlloadfile(null, fp, mxml_no_callback); fclose(fp); }
there mxml manual page.code:gcc -o mx mx.c -lmxml
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Unsure where I'm going wrong? mini xml install and usage
Ubuntu

Comments
Post a Comment