static GF_Err DumpLSRAddReplaceInsert(GF_SceneDumper *sdump, GF_Command *com)
{
	char szID[100];
	Bool is_text = 0;
	GF_CommandField *f;
	char *lsrns = sd_get_lsr_namespace(com->in_scene);

	const char *com_name = (com->tag==GF_SG_LSR_REPLACE) ? "Replace" : ( (com->tag==GF_SG_LSR_ADD) ? "Add" : "Insert" );

	DUMP_IND(sdump);

	gf_fprintf(sdump->trace, "<%s%s ref=\"%s\" ", lsrns, com_name, lsr_format_node_id(com->node, com->RouteID, szID));
	f = (GF_CommandField *) gf_list_get(com->command_fields, 0);
	if (f && (f->pos>=0) ) gf_fprintf(sdump->trace, "index=\"%d\" ", f->pos);
	if (f) {
		GF_FieldInfo info;
		if (!f->new_node && !f->node_list) {
			char *att_name = NULL;
			if (f->fieldType==SVG_Transform_Scale_datatype) att_name = "scale";
			else if (f->fieldType==SVG_Transform_Rotate_datatype) att_name = "rotation";
			else if (f->fieldType==SVG_Transform_Translate_datatype) att_name = "translation";
			else if (f->fieldIndex==(u32) -1) att_name = "textContent";
			else {
				if (!com->node) return GF_NON_COMPLIANT_BITSTREAM;
				att_name = (char*) gf_svg_get_attribute_name(com->node, f->fieldIndex);
			}

			gf_fprintf(sdump->trace, "attributeName=\"%s\" ", att_name);
			if (f->field_ptr) {
				char *att;
				info.far_ptr = f->field_ptr;
				info.fieldIndex = f->fieldIndex;
				info.fieldType = f->fieldType;
				info.name = att_name;

				if ((s32) f->pos >= 0) {
					att = gf_svg_dump_attribute_indexed(com->node, &info);
				} else {
					att = gf_svg_dump_attribute(com->node, &info);
				}
				gf_fprintf(sdump->trace, "value=\"%s\" ", att ? att : "");
				if (att) gf_free(att);
			}

			if (com->fromNodeID) {
				GF_FieldInfo op_info;
				GF_Node *op = gf_sg_find_node(sdump->sg, com->fromNodeID);
				gf_fprintf(sdump->trace, "operandElementId=\"%s\" ", lsr_format_node_id(op, com->RouteID, szID));
				gf_node_get_field(op, com->fromFieldIndex, &op_info);
				gf_fprintf(sdump->trace, "operandAttributeName=\"%s\" ", op_info.name);
			}

			gf_fprintf(sdump->trace, "/>\n");
			return GF_OK;
		}
		if (f->new_node && f->new_node->sgprivate->tag==TAG_DOMText) is_text = 1;
		/*if fieldIndex (eg attributeName) is set, this is children replacement*/
		if (f->fieldIndex>0)
			gf_fprintf(sdump->trace, "attributeName=\"children\" ");
	}


	gf_fprintf(sdump->trace, ">");
	if (!is_text) {
		gf_fprintf(sdump->trace, "\n");
		sdump->indent++;
	}
	if (f) {
		if (f->new_node) {
			gf_dump_svg_element(sdump, f->new_node, com->node, 0);
		} else if (f->node_list) {
			GF_ChildNodeItem *list = f->node_list;
			while (list) {
				gf_dump_svg_element(sdump, list->node, com->node, 0);
				list = list->next;
			}
		}
	}
	if (!is_text) {
		sdump->indent--;
		DUMP_IND(sdump);
	}
	gf_fprintf(sdump->trace, "</%s%s>\n", lsrns, com_name);
	return GF_OK;
}
static GF_Err DumpLSRAddReplaceInsert(GF_SceneDumper *sdump, GF_Command *com)
{
	char szID[100];
	Bool is_text = 0;
	GF_CommandField *f;
	char *lsrns = sd_get_lsr_namespace(com->in_scene);

	const char *com_name = (com->tag==GF_SG_LSR_REPLACE) ? "Replace" : ( (com->tag==GF_SG_LSR_ADD) ? "Add" : "Insert" );

	DUMP_IND(sdump);

	gf_fprintf(sdump->trace, "<%s%s ref=\"%s\" ", lsrns, com_name, lsr_format_node_id(com->node, com->RouteID, szID));
	f = (GF_CommandField *) gf_list_get(com->command_fields, 0);
	if (f && (f->pos>=0) ) gf_fprintf(sdump->trace, "index=\"%d\" ", f->pos);
	if (f) {
		GF_FieldInfo info;
		if (!f->new_node && !f->node_list) {
			char *att_name = NULL;
			if (f->fieldType==SVG_Transform_Scale_datatype) att_name = "scale";
			else if (f->fieldType==SVG_Transform_Rotate_datatype) att_name = "rotation";
			else if (f->fieldType==SVG_Transform_Translate_datatype) att_name = "translation";
			else if (f->fieldIndex==(u32) -1) att_name = "textContent";
			else {
				if (!com->node) return GF_NON_COMPLIANT_BITSTREAM;
				att_name = (char*) gf_svg_get_attribute_name(com->node, f->fieldIndex);
			}

			gf_fprintf(sdump->trace, "attributeName=\"%s\" ", att_name);
			if (f->field_ptr) {
				char *att;
				info.far_ptr = f->field_ptr;
				info.fieldIndex = f->fieldIndex;
				info.fieldType = f->fieldType;
				info.name = att_name;

				if ((s32) f->pos >= 0) {
					att = gf_svg_dump_attribute_indexed(com->node, &info);
				} else {
					att = gf_svg_dump_attribute(com->node, &info);
				}
				gf_fprintf(sdump->trace, "value=\"%s\" ", att ? att : "");
				if (att) gf_free(att);
			}

			if (com->fromNodeID) {
				GF_FieldInfo op_info;
				GF_Node *op = gf_sg_find_node(sdump->sg, com->fromNodeID);
				gf_fprintf(sdump->trace, "operandElementId=\"%s\" ", lsr_format_node_id(op, com->RouteID, szID));
				gf_node_get_field(op, com->fromFieldIndex, &op_info);
				gf_fprintf(sdump->trace, "operandAttributeName=\"%s\" ", op_info.name);
			}

			gf_fprintf(sdump->trace, "/>\n");
			return GF_OK;
		}
		if (f->new_node && f->new_node->sgprivate->tag==TAG_DOMText) is_text = 1;
		 
		if (f->fieldIndex>0)
			gf_fprintf(sdump->trace, "attributeName=\"children\" ");
	}


	gf_fprintf(sdump->trace, ">");
	if (!is_text) {
		gf_fprintf(sdump->trace, "\n");
		sdump->indent++;
	}
	if (f) {
		if (f->new_node) {
			gf_dump_svg_element(sdump, f->new_node, com->node, 0);
		} else if (f->node_list) {
			GF_ChildNodeItem *list = f->node_list;
			while (list) {
				gf_dump_svg_element(sdump, list->node, com->node, 0);
				list = list->next;
			}
		}
	}
	if (!is_text) {
		sdump->indent--;
		DUMP_IND(sdump);
	}
	gf_fprintf(sdump->trace, "</%s%s>\n", lsrns, com_name);
	return GF_OK;
}