[xml] predefined entity refs


I'm using libxml2 to parse XML files which contain digitally signed data. In order to validate the digital signature I have to loop through the XML elements and concatenate the relevant data into a single string. I'm running into a couple of problems with this.

The first problem involves the predefined entity refs &, <, >, ", and '. Ampersands are stored in the XML file that is being parsed as &amp; and that's what gets signed. So, when I'm looping through the XML retrieving the data, I need to get it in that form (&amp;). Calling xmlNodeListGetString or node->contents returns just the ampersand as a single character (&). Is there a way to get the contents exactly as it appears in the file? I have experimented with xmlSubstitueEntitiesDefault but it didn't make any difference.

The second problem is that the string shouldn't contain carriage return or line feed elements. I use xmlIsBlankNode to elminate these but in doing so I also eleminate elements that contain only spaces, which is not desirable. Is there a way to differentiate between them?

Thanks for your help.

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]