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
精彩评论