* xmlNsDumpOutput: * @buf: the XML buffer output * @cur: a namespace * @ctxt: the output save context. Optional. * * Dump a local Namespace definition. * Should be called in the context of attributes dumps. * If @ctxt is supplied, @buf should be its buffer. */
| 870 | * If @ctxt is supplied, @buf should be its buffer. |
| 871 | */ |
| 872 | static void |
| 873 | xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNsPtr cur, |
| 874 | xmlSaveCtxtPtr ctxt) { |
| 875 | if ((cur == NULL) || (buf == NULL)) return; |
| 876 | if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) { |
| 877 | if (xmlStrEqual(cur->prefix, BAD_CAST "xml")) |
| 878 | return; |
| 879 | |
| 880 | if (ctxt != NULL && ctxt->format == 2) |
| 881 | xmlOutputBufferWriteWSNonSig(ctxt, 2); |
| 882 | else |
| 883 | xmlOutputBufferWrite(buf, 1, " "); |
| 884 | |
| 885 | /* Within the context of an element attributes */ |
| 886 | if (cur->prefix != NULL) { |
| 887 | xmlOutputBufferWrite(buf, 6, "xmlns:"); |
| 888 | xmlOutputBufferWriteString(buf, (const char *)cur->prefix); |
| 889 | } else |
| 890 | xmlOutputBufferWrite(buf, 5, "xmlns"); |
| 891 | xmlOutputBufferWrite(buf, 2, "=\""); |
| 892 | xmlBufAttrSerializeTxtContent(buf, doc, cur->href); |
| 893 | xmlOutputBufferWrite(buf, 1, "\""); |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | /** |
| 898 | * xmlNsListDumpOutputCtxt |
no test coverage detected