Advertisement
Guest User

Untitled

a guest
Aug 19th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <libxml/xmlreader.h>
  4.  
  5. void main ()
  6. {
  7.     char *s = "<elem att1='foo' att2='bar'/>";
  8.    
  9.     xmlTextReaderPtr xml = xmlReaderForMemory (s, strlen(s), NULL, NULL, 0);
  10.    
  11.     while (xmlTextReaderRead (xml) == 1)
  12.         while (xmlTextReaderMoveToNextAttribute (xml) == 1)
  13.             while (xmlTextReaderReadAttributeValue (xml) == 1)
  14.                 printf ("%s\n", xmlTextReaderValue (xml));
  15. }
  16.  
  17. /* Compile with gcc -o attributevalue attributevalue.c `pkg-config --cflags --libs libxml-2.0` */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement