summaryrefslogtreecommitdiff
path: root/Source/WebCore/xml/parser/XMLTreeBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/xml/parser/XMLTreeBuilder.cpp')
-rw-r--r--Source/WebCore/xml/parser/XMLTreeBuilder.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp
index 81793ed6d..db213cd62 100644
--- a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp
+++ b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp
@@ -298,33 +298,27 @@ void XMLTreeBuilder::processEntity(const AtomicXMLToken& token)
void XMLTreeBuilder::processNamespaces(const AtomicXMLToken& token, NodeStackItem& stackItem)
{
- if (!token.attributes())
- return;
-
- for (size_t i = 0; i < token.attributes()->size(); ++i) {
- Attribute* attribute = token.attributes()->attributeItem(i);
- if (attribute->name().prefix() == xmlnsAtom)
- stackItem.setNamespaceURI(attribute->name().localName(), attribute->value());
- else if (attribute->name() == xmlnsAtom)
- stackItem.setNamespaceURI(attribute->value());
+ for (unsigned i = 0; i < token.attributes().size(); ++i) {
+ const Attribute& tokenAttribute = token.attributes().at(i);
+ if (tokenAttribute.name().prefix() == xmlnsAtom)
+ stackItem.setNamespaceURI(tokenAttribute.name().localName(), tokenAttribute.value());
+ else if (tokenAttribute.name() == xmlnsAtom)
+ stackItem.setNamespaceURI(tokenAttribute.value());
}
}
void XMLTreeBuilder::processAttributes(const AtomicXMLToken& token, NodeStackItem& stackItem, PassRefPtr<Element> newElement)
{
- if (!token.attributes())
- return;
-
- for (size_t i = 0; i < token.attributes()->size(); ++i) {
- Attribute* attribute = token.attributes()->attributeItem(i);
+ for (unsigned i = 0; i < token.attributes().size(); ++i) {
+ const Attribute& tokenAttribute = token.attributes().at(i);
ExceptionCode ec = 0;
- if (attribute->name().prefix() == xmlnsAtom)
- newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, "xmlns:" + attribute->name().localName(), attribute->value(), ec);
- else if (attribute->name() == xmlnsAtom)
- newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, xmlnsAtom, attribute->value(), ec);
+ if (tokenAttribute.name().prefix() == xmlnsAtom)
+ newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, "xmlns:" + tokenAttribute.name().localName(), tokenAttribute.value(), ec);
+ else if (tokenAttribute.name() == xmlnsAtom)
+ newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, xmlnsAtom, tokenAttribute.value(), ec);
else {
- QualifiedName qName(attribute->prefix(), attribute->localName(), stackItem.namespaceForPrefix(attribute->prefix(), nullAtom));
- newElement->setAttribute(qName, attribute->value());
+ QualifiedName qName(tokenAttribute.prefix(), tokenAttribute.localName(), stackItem.namespaceForPrefix(tokenAttribute.prefix(), nullAtom));
+ newElement->setAttribute(qName, tokenAttribute.value());
}
if (ec) {
m_parser->stopParsing();