XML_SetCharacterDataHandler() 함수는 prototype에서 보이는 대로
XML_char *s, int len 두개의 변수를 이용한다.

즉, 이 함수를 통해 받아들여지는 내용을 출력하기 위해서는
printf("%s",s); 가 아닌

for (int i = 0; i < len; i++) printf("%c",s[i]);
로 한글자씩 len에 맞게 출력을 해주어야 한다.

XML_SetCharacterDataHandler(XML_Parser p, XML_CharacterDataHandler charhndl)

typedef void (*XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len);

Set a text handler. The string your handler receives is NOT zero terminated. You have to use the length argument to deal with the end of the string. A single block of contiguous text free of markup may still result in a sequence of calls to this handler. In other words, if you're searching for a pattern in the text, it may be split across calls to this handler.

[링크 : http://www.xml.com/pub/a/1999/09/expat/index.html?page=3#chardatahandler]

<media:description type='plain'>The funniest 6 minutes you will ever see! Remember how many of these you have done! Follow @ http://www.twitter.com/judsonlaipply Check my book out at http://www.mightaswelldance.com
http://www.theevolutionofdance.com -
for more info including song list!</media:description>

                        <media:description type="plain">
========== [4]
The funniest 6 minutes you will ever see! Remember how many of these you have done! Follow @ http://www.twitter.com/judsonlaipply Ch
eck my book out at http://www.mightaswelldance.com
========== [4]


========== [4]
http://www.theevolutionofdance.com -
========== [4]


========== [4]
for more info including song list!
                        </media:description>

그리고, 위에 보이듯이, 줄단위로 받아들이므로
단순하게 한번 복사하는 걸로는 충분하지 않아 보인다.(어떻게 할지 모호하면.. realloc 해주어야 하나..)

'프로그램 사용 > expat & XML' 카테고리의 다른 글

SAX (Simple API for XML)  (0) 2010.04.23
xml 트리 탐색 - XML tree navigation  (0) 2010.04.17
&amp; &lt; &gt; &quot; 는 머지?  (0) 2010.03.31
expat '간략한' 사용법  (0) 2010.03.28
expat-2.0.1 example  (11) 2010.03.23
Posted by 구차니