Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C XML:从按元素剪切的文本中获取字符串数组_C_Xml_Libxml2 - Fatal编程技术网

C XML:从按元素剪切的文本中获取字符串数组

C XML:从按元素剪切的文本中获取字符串数组,c,xml,libxml2,C,Xml,Libxml2,我需要从节点中的文本中获取一个字符串数组,该文本本身被xml文件中的其他元素剪切。我在C语言中使用libxml2库 例如: 一些文本其他文本 我尝试了xmlNodeGetContent(xmlnode)

我需要从节点中的文本中获取一个字符串数组,该文本本身被xml文件中的其他元素剪切。我在C语言中使用libxml2库

例如:
一些文本其他文本

我尝试了
xmlNodeGetContent(xmlnode)“some text other text”


问题是:有没有可能得到一个字符串数组,在这个例子中,它将是
{“some text”,“other text”}

我已经找到了解决方案,我不得不说我感到惭愧,因为我花了太多时间才找到它

很简单,我再举一个例子:

<option>some text <middletag />other text</option>
结果:

some text
other text
现在,使用malloc/realloc,我们可以将其保存在一个数组中

some text
other text