a few newbie queistions

Norman Rosner <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Hi there,

i'm new to expat and i'm trying to use it to write a chartparser...

So i have a xml-document with this structure:



> <grammar>
> <productions>
> <rule>
> <INDEX>0</INDEX>
> <LHS>S</LHS>
> <RHS>NP VP</RHS>
> </rule>
>
> <rule>
> <INDEX>1</INDEX>
> <LHS>NP</LHS>
> <RHS>DET A N</RHS>
> </rule>
> .....

After installing expat on my machine I tried to figure out how it  
works so I observed the elements.c in the examples directory.

Now my questions that I could not solve until now - maybe you can  
help me:

based on the elements.c in the examples directory of expat i rewrote  
the startElement-function just to test something:

> static void XMLCALL
> startElement(void *userData, const char *name, const char **atts)
> {
>   if(name == "LHS") {
>     printf("LeftHandSide");
>   }
>   else {
>     printf("StartingElement : %s\n", name);
>   }
> }

Could anyone tell me why does my identitytesting in (name == "LHS")  
not work at all? Where is my Mistake in thinking?

Second Question:

How can i get the data that's in the elements. I tried the  
XML_SetCharacterDataHandler but it didn't work the way i intended it  
to work ;)
Can anyone send me an example or so where the data of the elements is  
just printed on stdout? That would be nice.


Thanks a lot for your help

so far
norman
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.