Changeset 79677 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Jul 10, 2019 3:45:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/ovfreader.cpp
r78604 r79677 107 107 if ((pTypeAttr = pRootElem->findAttribute("lang", "xml"))) 108 108 { 109 pcszTypeAttr = pTypeAttr->getValue ();109 pcszTypeAttr = pTypeAttr->getValueN(RT_XML_ATTR_TINY); 110 110 m_envelopeData.lang = pcszTypeAttr; 111 111 } … … 148 148 const char *pcszElemName = pElem->getName(); 149 149 const xml::AttributeNode *pTypeAttr = pElem->findAttribute("type"); 150 const char *pcszTypeAttr = pTypeAttr ? pTypeAttr->getValue () : "";150 const char *pcszTypeAttr = pTypeAttr ? pTypeAttr->getValueN(RT_XML_ATTR_TINY) : ""; 151 151 152 152 if ( !strcmp(pcszElemName, "DiskSection") … … 226 226 const char *pcszDiskId; 227 227 const char *pcszFormat; 228 if (!pelmDisk->getAttributeValue ("diskId", pcszDiskId))228 if (!pelmDisk->getAttributeValueN("diskId", pcszDiskId, RT_XML_ATTR_TINY)) 229 229 pcszBad = "diskId"; 230 else if (!pelmDisk->getAttributeValue ("format", pcszFormat))230 else if (!pelmDisk->getAttributeValueN("format", pcszFormat, RT_XML_ATTR_SMALL)) 231 231 pcszBad = "format"; 232 232 else if (!pelmDisk->getAttributeValue("capacity", d.iCapacity)) … … 242 242 243 243 // optional vbox:uuid attribute (if OVF was exported by VirtualBox != 3.2) 244 pelmDisk->getAttributeValue ("uuid", d.uuidVBox, "vbox");244 pelmDisk->getAttributeValueN("uuid", d.uuidVBox, RT_XML_ATTR_TINY, "vbox"); 245 245 246 246 const char *pcszFileRef; 247 if (pelmDisk->getAttributeValue ("fileRef", pcszFileRef)) // optional247 if (pelmDisk->getAttributeValueN("fileRef", pcszFileRef, RT_XML_ATTR_SMALL)) // optional 248 248 { 249 249 // look up corresponding /References/File nodes (list built above) … … 257 257 const char *pcszBadInFile = NULL; 258 258 const char *pcszHref; 259 if (!pFileElem->getAttributeValue ("href", pcszHref))259 if (!pFileElem->getAttributeValueN("href", pcszHref, RT_XML_ATTR_SMALL)) 260 260 pcszBadInFile = "href"; 261 261 else if (!pFileElem->getAttributeValue("size", d.iSize)) … … 267 267 d.iChunkSize = -1; // optional 268 268 const char *pcszCompression; 269 if (pFileElem->getAttributeValue ("compression", pcszCompression))269 if (pFileElem->getAttributeValueN("compression", pcszCompression, RT_XML_ATTR_TINY)) 270 270 d.strCompression = pcszCompression; 271 271 … … 350 350 const xml::AttributeNode *pIdAttr = pelmVirtualSystem->findAttribute("id"); 351 351 if (pIdAttr) 352 vsys.strName = pIdAttr->getValue ();352 vsys.strName = pIdAttr->getValueN(RT_XML_ATTR_SMALL); 353 353 354 354 xml::NodesLoop loop(*pelmVirtualSystem); // all child elements … … 362 362 const xml::AttributeNode *pTypeAttr = pelmThis->findAttribute("type"); 363 363 if (pTypeAttr) 364 pcszTypeAttr = pTypeAttr->getValue ();364 pcszTypeAttr = pTypeAttr->getValueN(RT_XML_ATTR_TINY); 365 365 else 366 366 throw OVFLogicError(N_("Error reading \"%s\": element \"Section\" has no \"type\" attribute, line %d"), … … 380 380 const xml::ElementNode *pelmLicense; 381 381 if ((pelmLicense = pelmThis->findChildElement("License"))) 382 vsys.strLicenseText = pelmLicense->getValue ();382 vsys.strLicenseText = pelmLicense->getValueN(RT_XML_CONTENT_LARGE); 383 383 } 384 384 if ( !strcmp(pcszElemName, "ProductSection") … … 396 396 const xml::ElementNode *pelmProduct; 397 397 if ((pelmProduct = pelmThis->findChildElement("Product"))) 398 vsys.strProduct = pelmProduct->getValue ();398 vsys.strProduct = pelmProduct->getValueN(RT_XML_CONTENT_SMALL); 399 399 const xml::ElementNode *pelmVendor; 400 400 if ((pelmVendor = pelmThis->findChildElement("Vendor"))) 401 vsys.strVendor = pelmVendor->getValue ();401 vsys.strVendor = pelmVendor->getValueN(RT_XML_CONTENT_SMALL); 402 402 const xml::ElementNode *pelmVersion; 403 403 if ((pelmVersion = pelmThis->findChildElement("Version"))) 404 vsys.strVersion = pelmVersion->getValue ();404 vsys.strVersion = pelmVersion->getValueN(RT_XML_CONTENT_SMALL); 405 405 const xml::ElementNode *pelmProductUrl; 406 406 if ((pelmProductUrl = pelmThis->findChildElement("ProductUrl"))) 407 vsys.strProductUrl = pelmProductUrl->getValue ();407 vsys.strProductUrl = pelmProductUrl->getValueN(RT_XML_CONTENT_SMALL); 408 408 const xml::ElementNode *pelmVendorUrl; 409 409 if ((pelmVendorUrl = pelmThis->findChildElement("VendorUrl"))) 410 vsys.strVendorUrl = pelmVendorUrl->getValue ();410 vsys.strVendorUrl = pelmVendorUrl->getValueN(RT_XML_CONTENT_SMALL); 411 411 } 412 412 else if ( !strcmp(pcszElemName, "VirtualHardwareSection") … … 425 425 </System>*/ 426 426 if ((pelmVirtualSystemType = pelmSystem->findChildElement("VirtualSystemType"))) 427 vsys.strVirtualSystemType = pelmVirtualSystemType->getValue ();427 vsys.strVirtualSystemType = pelmVirtualSystemType->getValueN(RT_XML_CONTENT_SMALL); 428 428 } 429 429 … … 792 792 const xml::ElementNode *pelmCIMOSDescription; 793 793 if ((pelmCIMOSDescription = pelmThis->findChildElement("Description"))) 794 vsys.strCimosDesc = pelmCIMOSDescription->getValue ();794 vsys.strCimosDesc = pelmCIMOSDescription->getValueN(RT_XML_CONTENT_SMALL); 795 795 796 796 const xml::ElementNode *pelmVBoxOSType; 797 797 if ((pelmVBoxOSType = pelmThis->findChildElementNS("vbox", // namespace 798 798 "OSType"))) // element name 799 vsys.strTypeVBox = pelmVBoxOSType->getValue ();799 vsys.strTypeVBox = pelmVBoxOSType->getValueN(RT_XML_CONTENT_SMALL); 800 800 } 801 801 else if ( (!strcmp(pcszElemName, "AnnotationSection")) … … 805 805 const xml::ElementNode *pelmAnnotation; 806 806 if ((pelmAnnotation = pelmThis->findChildElement("Annotation"))) 807 vsys.strDescription = pelmAnnotation->getValue ();807 vsys.strDescription = pelmAnnotation->getValueN(RT_XML_CONTENT_SMALL); 808 808 } 809 809 } … … 818 818 const char *pcszItemChildName = pelmItemChild->getName(); 819 819 if (!strcmp(pcszItemChildName, "Description")) 820 strDescription = pelmItemChild->getValue ();820 strDescription = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 821 821 else if (!strcmp(pcszItemChildName, "Caption")) 822 strCaption = pelmItemChild->getValue ();822 strCaption = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 823 823 else if (!strcmp(pcszItemChildName, "ElementName")) 824 strElementName = pelmItemChild->getValue ();824 strElementName = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 825 825 else if ( !strcmp(pcszItemChildName, "InstanceID") 826 826 || !strcmp(pcszItemChildName, "InstanceId") ) 827 827 pelmItemChild->copyValue(ulInstanceID); 828 828 else if (!strcmp(pcszItemChildName, "HostResource")) 829 strHostResource = pelmItemChild->getValue ();829 strHostResource = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 830 830 else if (!strcmp(pcszItemChildName, "ResourceType")) 831 831 { … … 835 835 fResourceRequired = true; 836 836 const char *pcszAttValue; 837 if (item->getAttributeValue ("required", pcszAttValue))837 if (item->getAttributeValueN("required", pcszAttValue, RT_XML_ATTR_TINY)) 838 838 { 839 839 if (!strcmp(pcszAttValue, "false")) … … 842 842 } 843 843 else if (!strcmp(pcszItemChildName, "OtherResourceType")) 844 strOtherResourceType = pelmItemChild->getValue ();844 strOtherResourceType = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 845 845 else if (!strcmp(pcszItemChildName, "ResourceSubType")) 846 strResourceSubType = pelmItemChild->getValue ();846 strResourceSubType = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 847 847 else if (!strcmp(pcszItemChildName, "AutomaticAllocation")) 848 fAutomaticAllocation = (!strcmp(pelmItemChild->getValue (), "true")) ? true : false;848 fAutomaticAllocation = (!strcmp(pelmItemChild->getValueN(RT_XML_CONTENT_SMALL), "true")) ? true : false; 849 849 else if (!strcmp(pcszItemChildName, "AutomaticDeallocation")) 850 fAutomaticDeallocation = (!strcmp(pelmItemChild->getValue (), "true")) ? true : false;850 fAutomaticDeallocation = (!strcmp(pelmItemChild->getValueN(RT_XML_CONTENT_SMALL), "true")) ? true : false; 851 851 else if (!strcmp(pcszItemChildName, "Parent")) 852 852 pelmItemChild->copyValue(ulParent); 853 853 else if (!strcmp(pcszItemChildName, "Connection")) 854 strConnection = pelmItemChild->getValue ();854 strConnection = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 855 855 else if (!strcmp(pcszItemChildName, "Address")) 856 856 { 857 strAddress = pelmItemChild->getValue ();857 strAddress = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 858 858 pelmItemChild->copyValue(lAddress); 859 859 } 860 860 else if (!strcmp(pcszItemChildName, "AddressOnParent")) 861 strAddressOnParent = pelmItemChild->getValue ();861 strAddressOnParent = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 862 862 else if (!strcmp(pcszItemChildName, "AllocationUnits")) 863 strAllocationUnits = pelmItemChild->getValue ();863 strAllocationUnits = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 864 864 else if (!strcmp(pcszItemChildName, "VirtualQuantity")) 865 865 pelmItemChild->copyValue(ullVirtualQuantity); … … 871 871 pelmItemChild->copyValue(ullWeight); 872 872 else if (!strcmp(pcszItemChildName, "ConsumerVisibility")) 873 strConsumerVisibility = pelmItemChild->getValue ();873 strConsumerVisibility = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 874 874 else if (!strcmp(pcszItemChildName, "MappingBehavior")) 875 strMappingBehavior = pelmItemChild->getValue ();875 strMappingBehavior = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 876 876 else if (!strcmp(pcszItemChildName, "PoolID")) 877 strPoolID = pelmItemChild->getValue ();877 strPoolID = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 878 878 else if (!strcmp(pcszItemChildName, "BusNumber")) 879 879 pelmItemChild->copyValue(ulBusNumber); … … 921 921 const char *pcszItemChildName = pelmItemChild->getName(); 922 922 if (!strcmp(pcszItemChildName, "HostExtentName")) 923 strHostExtentName = pelmItemChild->getValue ();923 strHostExtentName = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 924 924 else if (!strcmp(pcszItemChildName, "OtherHostExtentNameFormat")) 925 strOtherHostExtentNameFormat = pelmItemChild->getValue ();925 strOtherHostExtentNameFormat = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 926 926 else if (!strcmp(pcszItemChildName, "OtherHostExtentNameNamespace")) 927 strOtherHostExtentNameNamespace = pelmItemChild->getValue ();927 strOtherHostExtentNameNamespace = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 928 928 else if (!strcmp(pcszItemChildName, "VirtualQuantityUnits")) 929 strVirtualQuantityUnits = pelmItemChild->getValue ();929 strVirtualQuantityUnits = pelmItemChild->getValueN(RT_XML_CONTENT_SMALL); 930 930 else if (!strcmp(pcszItemChildName, "Access")) 931 931 {
Note:
See TracChangeset
for help on using the changeset viewer.