开发者

read from stdin for libxml2 in C

开发者 https://www.devze.com 2023-01-11 08:46 出处:网络
I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a programI am writing using libxml2.I can parse fine using a reader from the function xmlTextReade

I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a program I am writing using libxml2. I can parse fine using a reader from the function xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename) when I hav开发者_如何学Goe a char * to the name of the file. I would preferably like to wind up with a reader so the rest of my program remains the same.

Thank you.


I believe the best thing to do is to use the opening function that contains a file descriptor as the parameter and pass STDIN_FILENO.

http://www.xmlsoft.org/html/libxml-xmlreader.html#xmlReaderNewFd

0

精彩评论

暂无评论...
验证码 换一张
取 消