Lines Matching refs:Node
99 static xmlAttrPtr getAttribute(xmlNodePtr Node, in getAttribute() argument
101 for (xmlAttrPtr Attribute = Node->properties; Attribute != nullptr; in getAttribute()
127 static xmlNsPtr search(const unsigned char *HRef, xmlNodePtr Node) { in search() argument
128 for (xmlNsPtr Def = Node->nsDef; Def; Def = Def->next) { in search()
133 if (Node->parent) { in search()
134 return search(HRef, Node->parent); in search()
155 xmlNodePtr Node) { in searchOrDefine() argument
156 if (xmlNsPtr Def = search(HRef, Node)) in searchOrDefine()
158 if (xmlNsPtr Def = xmlNewNs(Node, HRef, getPrefixForHref(HRef))) in searchOrDefine()
180 xmlNodePtr Node) { in getNamespaceWithPrefix() argument
181 if (Node == nullptr) in getNamespaceWithPrefix()
183 for (xmlNsPtr Def = Node->nsDef; Def; Def = Def->next) { in getNamespaceWithPrefix()
194 static xmlNsPtr getClosestDefault(xmlNodePtr Node) { in getClosestDefault() argument
195 if (xmlNsPtr Ret = getNamespaceWithPrefix(nullptr, Node)) in getClosestDefault()
197 if (Node->parent == nullptr) in getClosestDefault()
199 return getClosestDefault(Node->parent); in getClosestDefault()
291 static bool hasInheritedNs(xmlNodePtr Node) { in hasInheritedNs() argument
292 return Node->ns && Node->ns != getNamespaceWithPrefix(Node->ns->prefix, Node); in hasInheritedNs()
297 static bool hasInheritedDefaultNs(xmlNodePtr Node) { in hasInheritedDefaultNs() argument
298 return hasInheritedNs(Node) && Node->ns->prefix == nullptr; in hasInheritedDefaultNs()
302 static bool hasDefinedDefaultNamespace(xmlNodePtr Node) { in hasDefinedDefaultNamespace() argument
303 return Node->ns && (Node->ns == getNamespaceWithPrefix(nullptr, Node)); in hasDefinedDefaultNamespace()
311 static void explicateNamespace(xmlNsPtr PrefixDef, xmlNodePtr Node) { in explicateNamespace() argument
315 if (hasDefinedDefaultNamespace(Node)) in explicateNamespace()
317 if (Node->ns && xmlStringsEqual(Node->ns->href, PrefixDef->href) && in explicateNamespace()
318 hasInheritedDefaultNs(Node)) in explicateNamespace()
319 Node->ns = PrefixDef; in explicateNamespace()
320 for (xmlAttrPtr Attribute = Node->properties; Attribute; in explicateNamespace()
327 for (xmlNodePtr Child = Node->children; Child; Child = Child->next) { in explicateNamespace()
483 static bool hasRecognizedNamespace(xmlNodePtr Node) { in hasRecognizedNamespace() argument
484 return isRecognizedNamespace(Node->ns->href); in hasRecognizedNamespace()
489 static Error reconcileNamespaces(xmlNodePtr Node) { in reconcileNamespaces() argument
490 if (!Node) { in reconcileNamespaces()
493 if (hasInheritedNs(Node)) { in reconcileNamespaces()
494 Expected<xmlNsPtr> ExplicitOrError = searchOrDefine(Node->ns->href, Node); in reconcileNamespaces()
499 Node->ns = Explicit; in reconcileNamespaces()
501 for (xmlNodePtr Child = Node->children; Child; Child = Child->next) { in reconcileNamespaces()
560 static void setAttributeNamespaces(xmlNodePtr Node) { in setAttributeNamespaces() argument
561 for (xmlAttrPtr Attribute = Node->properties; Attribute; in setAttributeNamespaces()
564 Attribute->ns = getClosestDefault(Node); in setAttributeNamespaces()
567 for (xmlNodePtr Child = Node->children; Child; Child = Child->next) { in setAttributeNamespaces()
574 static void checkAndStripPrefixes(xmlNodePtr Node, in checkAndStripPrefixes() argument
576 for (xmlNodePtr Child = Node->children; Child; Child = Child->next) { in checkAndStripPrefixes()
579 if (Node->ns && Node->ns->prefix != nullptr) { in checkAndStripPrefixes()
580 xmlNsPtr ClosestDefault = getClosestDefault(Node); in checkAndStripPrefixes()
582 xmlStringsEqual(ClosestDefault->href, Node->ns->href)) { in checkAndStripPrefixes()
583 Node->ns = ClosestDefault; in checkAndStripPrefixes()
584 } else if (!llvm::is_contained(RequiredPrefixes, Node->ns)) { in checkAndStripPrefixes()
585 RequiredPrefixes.push_back(Node->ns); in checkAndStripPrefixes()
588 for (xmlAttrPtr Attribute = Node->properties; Attribute; in checkAndStripPrefixes()
591 xmlNsPtr ClosestDefault = getClosestDefault(Node); in checkAndStripPrefixes()
595 } else if (!llvm::is_contained(RequiredPrefixes, Node->ns)) { in checkAndStripPrefixes()
602 for (xmlNsPtr Def = Node->nsDef; Def; Def = Def->next) { in checkAndStripPrefixes()
607 if (Def == Node->nsDef) { in checkAndStripPrefixes()
608 Node->nsDef = Def->next; in checkAndStripPrefixes()