Re: [xml] Hi, noobie troubles with xml examples



Leon Sam wrote:
After reading and reading i finally got mingw working with libxml.

i think i included the right libraries cuz my makefile actually finally compiles the web examples..

the problem is i cant open my xml files..

my programs keep thinking argc <=1
i dont even know what argc is!!!


i wasnt sure how to name my files. i assumed that docname was the supposed name of my xml file.

i made xml files in the same directory named docname and docname.xml and when i open my executable i still get the words Usage: %s docname\n", argv[0]

so my question is. after i compile my program what is the proper name i should give my file so that my compiled program will actually open my xml file and read it..

i used Open Xml Editor to edit my xml's..

int
main(int argc, char **argv) {

    char *docname;

    if (argc <= 1) {
        printf("Usage: %s docname\n", argv[0]);
        return(0);
    }

    docname = argv[1];
    parseDoc (docname);

    return (1);
}

im trying compile the keyword example in the libxml tutorial and trying to get it to read the sample document provided..


any help at all would be appreciated.. i just dont understand why my program wont open the xml file or how to name it properly


Hi Leon,

Since you say that you don't know what argc is, I'm going to give you very basic advice. Don't be offended. :-)

When you run your program, you need to do it like this:
myProgramName myXmlFileName

It should not matter what you have named the XML file. If it is in a directory different from the one where the program lives, you should probably specify the full path.

From your description of your problem, it sounds like you aren't passing the XML file name as a command line parameter.

- Rush

P.S. argc contains the number of command line arguments, while argv is an array of strings that contain each of the command line parameters. You always get the name of the program you're running in argv[0], so argc is always at least one, but the program expects to see another argument.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]