From 8cb5d8815da673747b729d5e0a05a5cdc11a9081 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Tue, 9 Dec 2014 15:26:06 +0100 Subject: Allow more flexibility in overriding CElement::toXml The toXml method has a default implementation that recursively calls toXml on the children and set their "Name" attribute. With this approach, the toplevel element's name isn't set unless its overrided implementation explicitly does so. A first approach for fixing that is to set the XmlElement's name and recursively call toXml on children (without setting their name because it will be done by their toXml method). However, the "CXmlElement" being created may or may not be the object on which the toXml method is called, in which case the name will be set on the wrong XmlElement. Instead, in CElement::toXml, we set the XmlElement's name and call a new virtual method, childrenToXml which only recursively call toXml on children. This gives full flexibility to elements to choose how they want to serialize themselves and how they want to serialize their children. CConfigurableDomain::toXml is modified to take that change into account. Change-Id: Id12a1023e91cb000e55c242c13643b1db7d46871 Signed-off-by: David Wagner --- parameter/ConfigurableDomains.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parameter/ConfigurableDomains.cpp') diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp index f11a155..dd7ede3 100644 --- a/parameter/ConfigurableDomains.cpp +++ b/parameter/ConfigurableDomains.cpp @@ -104,7 +104,7 @@ void CConfigurableDomains::toXml(CXmlElement& xmlElement, CXmlSerializingContext // Set attribute xmlElement.setAttributeString("SystemClassName", getName()); - base::toXml(xmlElement, serializingContext); + base::childrenToXml(xmlElement, serializingContext); } // Configuration/Domains handling -- cgit v1.1