OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 break; | 794 break; |
795 parentElement = toElement(n); | 795 parentElement = toElement(n); |
796 } | 796 } |
797 | 797 |
798 if (elemStack.isEmpty()) | 798 if (elemStack.isEmpty()) |
799 return; | 799 return; |
800 | 800 |
801 for (; !elemStack.isEmpty(); elemStack.removeLast()) { | 801 for (; !elemStack.isEmpty(); elemStack.removeLast()) { |
802 Element* element = elemStack.last(); | 802 Element* element = elemStack.last(); |
803 if (element->hasAttributes()) { | 803 if (element->hasAttributes()) { |
804 unsigned attributeCount = element->attributeCount(); | 804 AttributeIteratorAccessor attributes = element->attributesIterator()
; |
805 for (unsigned i = 0; i < attributeCount; ++i) { | 805 AttributeConstIterator end = attributes.end(); |
806 const Attribute& attribute = element->attributeItem(i); | 806 for (AttributeConstIterator it = attributes.begin(); it != end; ++it
) { |
807 if (attribute.localName() == xmlnsAtom) | 807 if (it->localName() == xmlnsAtom) |
808 m_defaultNamespaceURI = attribute.value(); | 808 m_defaultNamespaceURI = it->value(); |
809 else if (attribute.prefix() == xmlnsAtom) | 809 else if (it->prefix() == xmlnsAtom) |
810 m_prefixToNamespaceMap.set(attribute.localName(), attribute.
value()); | 810 m_prefixToNamespaceMap.set(it->localName(), it->value()); |
811 } | 811 } |
812 } | 812 } |
813 } | 813 } |
814 | 814 |
815 // If the parent element is not in document tree, there may be no xmlns attr
ibute; just default to the parent's namespace. | 815 // If the parent element is not in document tree, there may be no xmlns attr
ibute; just default to the parent's namespace. |
816 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) | 816 if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument()) |
817 m_defaultNamespaceURI = parentElement->namespaceURI(); | 817 m_defaultNamespaceURI = parentElement->namespaceURI(); |
818 } | 818 } |
819 | 819 |
820 XMLParserContext::~XMLParserContext() | 820 XMLParserContext::~XMLParserContext() |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 sax.initialized = XML_SAX2_MAGIC; | 1610 sax.initialized = XML_SAX2_MAGIC; |
1611 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1611 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1612 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1612 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1613 parseChunk(parser->context(), parseString); | 1613 parseChunk(parser->context(), parseString); |
1614 finishParsing(parser->context()); | 1614 finishParsing(parser->context()); |
1615 attrsOK = state.gotAttributes; | 1615 attrsOK = state.gotAttributes; |
1616 return state.attributes; | 1616 return state.attributes; |
1617 } | 1617 } |
1618 | 1618 |
1619 } // namespace WebCore | 1619 } // namespace WebCore |
OLD | NEW |