Hey, I’m trying to use VTD-XML to parse XML given to it as a String, but I can’t find how to do it. Any help would be appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It seems VTD-XML library lets you read byte array data. I’d suggest in that case, convert the String to bytes using the correct encoding.
If there’s an encoding signaled in the begining of the XML string:
Then use that:
If there’s not an encoding, please use one, for VTD-XML know how to decode the bytes:
Note that in the later case you can use any valid encoding because the string you have in memory is encoding-agnosting (it’s in UTF-16 but when you ask for the bytes it will be converted).