MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / writeStartElement

Method writeStartElement

base/poco/XML/src/XMLWriter.cpp:588–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586
587
588void XMLWriter::writeStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes)
589{
590 if (!_nsContextPushed)
591 _namespaces.pushContext();
592 _nsContextPushed = false;
593 ++_elementCount;
594
595 declareAttributeNamespaces(attributes);
596
597 writeMarkup(MARKUP_LT);
598 if (!localName.empty() && (qname.empty() || localName == qname))
599 {
600 XMLString prefix;
601 if (!namespaceURI.empty() && !_namespaces.isMapped(namespaceURI))
602 {
603 prefix = uniquePrefix();
604 _namespaces.declarePrefix(prefix, namespaceURI);
605 }
606 else prefix = _namespaces.getPrefix(namespaceURI);
607 writeName(prefix, localName);
608 }
609 else if (namespaceURI.empty() && localName.empty() && !qname.empty())
610 {
611 writeXML(qname);
612 }
613 else if (!localName.empty() && !qname.empty())
614 {
615 XMLString local;
616 XMLString prefix;
617 Name::split(qname, prefix, local);
618 if (prefix.empty()) prefix = _namespaces.getPrefix(namespaceURI);
619 const XMLString& uri = _namespaces.getURI(prefix);
620 if ((uri.empty() || uri != namespaceURI) && !namespaceURI.empty())
621 {
622 _namespaces.declarePrefix(prefix, namespaceURI);
623 }
624 writeName(prefix, localName);
625 }
626 else throw XMLException("Tag mismatch", nameToString(localName, qname));
627
628 AttributeMap attributeMap;
629 addNamespaceAttributes(attributeMap);
630 addAttributes(attributeMap, attributes, namespaceURI);
631 writeAttributes(attributeMap);
632 _unclosedStartTag = true;
633}
634
635
636void XMLWriter::writeCanonicalStartElement(const XMLString& namespaceURI, const XMLString& localName, const XMLString& qname, const Attributes& attributes)

Callers

nothing calls this directly

Calls 6

isMappedMethod · 0.80
declarePrefixMethod · 0.80
getURIMethod · 0.80
splitFunction · 0.50
pushContextMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected