"Re: [xml] how to write a xmlAttr with xmlTextWriter?"
- From: Kasimier Buchcik <kbuchcik 4commerce de>
- To: <xml gnome org>
- Subject: "Re: [xml] how to write a xmlAttr with xmlTextWriter?"
- Date: Tue, 10 Feb 2004 16:38:10 +0100
Hi,
on 2/10/2004 2:23 PM Kasimier Buchcik wrote:
Hi,
does there exist a function that can serialize the content of a xmlAttr
(attr->children) to be used with "xmlTextWriterWriteAttribute"? It
should bear analogy to "xmlAttrSerializeContent" which is used by the
serialization mechanism internally. If no, did someone already succeded
in xml-text-writing an xmlAttr?
Hmm, I tried the following combination but it does not behave properly:
attrVal = xmlNodeListGetString(NULL, attr->children, 0);
xmlTextWriterWriteAttribute(writer, attr->name, attrVal);
Since "xmlNodeListGetString" and "xmlTextWriterWriteAttribute" both lead
to a "&" to "&" conversion, I get a recursive conversion if cycling
serialization & parsing:
"<" --> "&lt;" --> "&amp;lt;" --> etc.
Entity references will be mangled by xmlTextWriterWriteAttribute.
Is there any chance of adding to "xmlAttrSerializeTxtContent" (called by
"xmlTextWriterWriteAttribute") a heuristic evaluation if a "&" is a
beginning of an entity reference or not? But maby this does not fit in
the big picture. Any other clues?
Regards,
Kasimier
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]