Changeset 27918 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Mar 31, 2010 5:10:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/xml.cpp
r27418 r27918 506 506 } 507 507 508 bool Node::nameEquals(const char *pcsz) const 508 /** 509 * Variant of nameEquals that checks the namespace as well. 510 * @param pcszNamespace 511 * @param pcsz 512 * @return 513 */ 514 bool Node::nameEquals(const char *pcszNamespace, const char *pcsz) const 509 515 { 510 516 if (m->pcszName == pcsz) … … 514 520 if (pcsz == NULL) 515 521 return false; 516 return !strcmp(m->pcszName, pcsz); 517 } 518 522 if (strcmp(m->pcszName, pcsz)) 523 return false; 524 525 // name matches: then check namespaces as well 526 if (!pcszNamespace) 527 return true; 528 // caller wants namespace: 529 if ( !m->plibNode->ns 530 || !m->plibNode->ns->prefix 531 || !*m->plibNode->ns->prefix 532 ) 533 // but node has no namespace: 534 return false; 535 return !strcmp((const char*)m->plibNode->ns->prefix, pcszNamespace); 536 } 519 537 520 538 /** … … 663 681 /** 664 682 * Returns the first child element whose name matches pcszMatch. 665 * @param pcszMatch 683 * 684 * @param pcszNamespace Namespace prefix (e.g. "vbox") or NULL to match any namespace. 685 * @param pcszMatch Element name to match. 666 686 * @return 667 687 */ 668 const ElementNode* ElementNode::findChildElement(const char *pcszMatch) 688 const ElementNode* ElementNode::findChildElement(const char *pcszNamespace, 689 const char *pcszMatch) 669 690 const 670 691 { … … 679 700 { 680 701 ElementNode *pelm = static_cast<ElementNode*>((*it).get()); 681 if ( !strcmp(pcszMatch, pelm->getName())) // the element name matches702 if (pelm->nameEquals(pcszNamespace, pcszMatch)) 682 703 return pelm; 683 704 }
Note:
See TracChangeset
for help on using the changeset viewer.