Example #1
0
void XMLTreeBuilder::processNamespaces(const AtomicXMLToken& token, NodeStackItem& stackItem)
{
    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());
    }
}
Example #2
0
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());
    }
}
Example #3
0
void XMLTreeBuilder::processAttributes(const AtomicXMLToken& token, NodeStackItem& stackItem, PassRefPtr<Element> newElement)
{
    for (unsigned i = 0; i < token.attributes().size(); ++i) {
        const Attribute& tokenAttribute = token.attributes().at(i);
        ExceptionCode ec = 0;
        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(tokenAttribute.prefix(), tokenAttribute.localName(), stackItem.namespaceForPrefix(tokenAttribute.prefix(), nullAtom));
            newElement->setAttribute(qName, tokenAttribute.value());
        }
        if (ec) {
            m_parser->stopParsing();
            return;
        }
    }
}
Example #4
0
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);
        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);
        else {
            QualifiedName qName(attribute->prefix(), attribute->localName(), stackItem.namespaceForPrefix(attribute->prefix(), nullAtom));
            newElement->setAttribute(qName, attribute->value());
        }
        if (ec) {
            m_parser->stopParsing();
            return;
        }
    }
}