Here is the required XML format that I am looking for:
<mf:package
xmlns="urn:x-lexisnexis:content:manifest:global:1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:x-lexisnexis:content:manifest:global:1 sch_manifest.xsd"
mf:mf="urn:x-lexisnexis:content:manifest:global:1">
What I am getting is:
<mf:package
xmlns="urn:x-lexisnexis:content:manifest:global:1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:x-lexisnexis:content:manifest:global:1 sch_manifest.xsd"
xmlns:mf="urn:x-lexisnexis:content:manifest:global:1">
The code I am using is:
using (XmlWriter writer = XmlWriter.Create(parentPathPackage + packageID + "_man.xml", settings))
{
writer.WriteStartElement("mf", "package", "urn:x-lexisnexis:content:manifest:global:1");
writer.WriteAttributeString("", "xmlns", null, "urn:x-lexisnexis:content:manifest:global:1");
writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance");
writer.WriteAttributeString("xsi", "schemaLocation", null, "urn:x-lexisnexis:content:manifest:global:1 sch_manifest.xsd");
What am I doing wrong here?
Errors in the XML document: 1: 250 The prefix "mf" for element "mf:package" is not bound.Specifically, you define an element<mf:package ...but never associate themfprefix to a namespace.mf:mf=".."is not the correct way to do that.xmlns:mf=".."is the correct way, i.e.XmlWriterfixed it for you automatically. (That is, unless your XML is a fragment of some larger document that does define themfnamespace.)<mf:package xmlns="urn:x-lexisnexis:content:manifest:global:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:x-lexisnexis:content:manifest:global:1 sch_manifest.xsd" mf:mf="urn:x-lexisnexis:content:manifest:global:1"> <mf:metadata allOrNone="0" contentProviderID="KM_SEC_CONTENT" contentProviderIDScheme="Knowledge Mosaic ID" id="abc"> <mf:dataFiles mf:mf="urn:x-lexisnexis:content:manifest:global:1">