proto_item_fill_label(fi, label_str);
}
- if(PROTO_ITEM_IS_GENERATED(node)) {
- label_ptr = g_strdup_printf("[%s]", label_ptr);
- }
+ if (PROTO_ITEM_IS_GENERATED(node)) {
+ label_ptr = g_strdup_printf("[%s]", label_ptr);
+ }
if (!print_line(pdata->stream, pdata->level, label_ptr)) {
pdata->success = FALSE;
return;
}
- if(PROTO_ITEM_IS_GENERATED(node)) {
- g_free(label_ptr);
- }
+ if (PROTO_ITEM_IS_GENERATED(node)) {
+ g_free(label_ptr);
+ }
/* If it's uninterpreted data, dump it (unless our caller will
be printing the entire packet in hex). */
label_ptr = "";
}
- fputs("<field show=\"", pdata->fh);
+ /* Show empty name since it is a required field */
+ fputs("<field name=\"", pdata->fh);
+ fputs("\" show=\"", pdata->fh);
print_escaped_xml(pdata->fh, label_ptr);
fprintf(pdata->fh, "\" size=\"%d", fi->length);
default:
/* XXX - this is a hack until we can just call
* fvalue_to_string_repr() for *all* FT_* types. */
- dfilter_string = proto_construct_dfilter_string(fi,
- pdata->edt);
+ dfilter_string = proto_construct_match_selected_string(fi,
+ pdata->edt);
if (dfilter_string != NULL) {
chop_len = strlen(fi->hfinfo->abbrev) + 4; /* for " == " */
fputs("\" show=\"", pdata->fh);
print_escaped_xml(pdata->fh, &dfilter_string[chop_len]);
}
+
+ /*
+ * XXX - should we omit "value" for any fields?
+ * What should we do for fields whose length is 0?
+ * They might come from a pseudo-header or from
+ * the capture header (e.g., time stamps), or
+ * they might be generated fields.
+ */
if (fi->length > 0) {
fputs("\" value=\"", pdata->fh);
write_pdml_field_hex_value(pdata, fi);
}
else {
- write_pdml_field_hex_value(pdata, fi);
- }
+ write_pdml_field_hex_value(pdata, fi);
+ }
}
}