본문 바로가기

Lecture & Tip/linux programming[리눅스]

Check, When XML String always misses all attributes by XBinder!

I'm sure that the attribute values are set on xbinder structure, But XBinder always lost all values when it encodes.

ex code)

Init_a_ELEM(&pctxt, &a_ELEM);
a_ELEM.u.attr1.value = blurblur;
a_ELEM.u.attr2 = int_val;
rtXmlSetEncBufPtr(&pctxt, ouput_string, 1024);
XmlE_a_ELEM(&pctxt, &a_ELEM);

result)
<a />


-,.-;;;;;;;

.
So I was googling, but the result is useless...
.
!
.
When I see the sample code, I found something...and changed the code

ex code)

Init_a_ELEM(&pctxt, &a_ELEM);
a_ELEM.u.attr1.value = blurblur;
a_ELEM.u.attr2 = int_val;
a_ELEM.m.attr1Present = TRUE;   //added
a_ELEM.m.attr2Present = TRUE;   //added
rtXmlSetEncBufPtr(&pctxt, ouput_string, 1024);
XmlE_a_ELEM(&pctxt, &a_ELEM);

result)
<a attr1="blurblur" attr2="int_val"/>

o,.0);;; it works;;;;

Why did I write this useless article?

Because there are so many people who did kill the time as like me..;;