Re: [xml] Are there any chance to keep single quotes as attribute text boundary?



You must escape the ' with the proper XML entity, in this case '

Example:

<aaa bbb='&apos;ccc&apos;'/>

On Dec 11, 2010, at 8:44 AM, Nikolay Shaplov wrote:

libxml replaces single quotes in attribute with double quotes when
reading and then dumping xml document:

int main()
{
 LIBXML_TEST_VERSION                                                                                                                                      
 xmlDocPtr doc;
 char * str = "<aaa bbb='ccc'/>";
 doc = xmlReadMemory(str, strlen(str), "include.xml", NULL, 0);
 xmlDocDump(stdout, doc);
 xmlFreeDoc(doc);
 return(0);                                                                                                                                               
}

running this will show

<?xml version="1.0"?>
<aaa bbb="ccc"/>

This is not diff safely :-/

Are there any chance to keep formatting as it were, at least for
elements that were not changed during tree elements manipulation? May
be there is some parsing options I do not know of?

If not how difficult would it be to add such support, in your opinion,
and would it be added if somebody offers the patch? or this does not
fit some project's conception?
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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