Changeset 68048 in vbox
- Timestamp:
- Jul 19, 2017 3:02:01 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117072
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r67793 r68048 810 810 throw ConfigFileError(this, &elmMedium, N_("Required %s/@location attribute is missing"), elmMedium.getName()); 811 811 812 elmMedium.getAttributeValue("Description", med.strDescription); // optional 813 814 // handle medium properties 815 xml::NodesLoop nl2(elmMedium, "Property"); 816 const xml::ElementNode *pelmHDChild; 817 while ((pelmHDChild = nl2.forAllNodes())) 818 { 819 Utf8Str strPropName, strPropValue; 820 if ( pelmHDChild->getAttributeValue("name", strPropName) 821 && pelmHDChild->getAttributeValue("value", strPropValue) ) 822 med.properties[strPropName] = strPropValue; 823 else 824 throw ConfigFileError(this, pelmHDChild, N_("Required HardDisk/Property/@name or @value attribute is missing")); 812 // 3.2 builds added Description as an attribute, read it silently 813 // and write it back as an element starting with 5.1.26 814 elmMedium.getAttributeValue("Description", med.strDescription); 815 816 xml::NodesLoop nlMediumChildren(elmMedium); 817 const xml::ElementNode *pelmMediumChild; 818 while ((pelmMediumChild = nlMediumChildren.forAllNodes())) 819 { 820 if (pelmMediumChild->nameEquals("Description")) 821 med.strDescription = pelmMediumChild->getValue(); 822 else if (pelmMediumChild->nameEquals("Property")) 823 { 824 // handle medium properties 825 Utf8Str strPropName, strPropValue; 826 if ( pelmMediumChild->getAttributeValue("name", strPropName) 827 && pelmMediumChild->getAttributeValue("value", strPropValue) ) 828 med.properties[strPropName] = strPropValue; 829 else 830 throw ConfigFileError(this, pelmMediumChild, N_("Required HardDisk/Property/@name or @value attribute is missing")); 831 } 825 832 } 826 833 } … … 1266 1273 pelmMedium->setAttribute("autoReset", mdm.fAutoReset); 1267 1274 if (mdm.strDescription.length()) 1268 pelmMedium-> setAttribute("Description",mdm.strDescription);1275 pelmMedium->createChild("Description")->addContent(mdm.strDescription); 1269 1276 1270 1277 for (StringsMap::const_iterator it = mdm.properties.begin(); … … 4957 4964 throw ConfigFileError(this, &elmSnapshot, N_("Required Snapshot/@name attribute is missing")); 4958 4965 4959 // earlier 3.1 trunk builds had a bug and added Description as an attribute, read it silently and write it back as an element 4966 // 3.1 dev builds added Description as an attribute, read it silently 4967 // and write it back as an element 4960 4968 elmSnapshot.getAttributeValue("Description", snap.strDescription); 4961 4969
Note:
See TracChangeset
for help on using the changeset viewer.