/// <summary> /// Adds a <?Mapping?> processing instruction (PI) to a list. Generated xmls will contain the Mapping PIs. /// </summary> /// <param name="xmlNamespace"></param> /// <param name="clrNamespace"></param> /// <param name="assembly"></param> /// <remarks> /// Calling with xmlNamespace="custom", clrNamespace="Windows.Test.Custom", and assembly="CustomControls" would /// cause the following line to be included in every generated xml: /// <?Mapping XmlNamespace="custom" ClrNamespace="Windows.Test.Custom" Assembly="CustomControls" ?> /// </remarks> public void AddMappingPI(string xmlNamespace, string clrNamespace, string assembly) { MappingPIComponent mapppingPIComponenet = new MappingPIComponent(); mapppingPIComponenet.XmlNamespace = xmlNamespace; mapppingPIComponenet.ClrNamespace = clrNamespace; mapppingPIComponenet.Assembly = assembly; _mappingPIs.Add(mapppingPIComponenet); }
/// <summary> /// Writes Mapping PIs. /// </summary> private void _CreateMappingPIs(XmlDocument xmlDocument) { for (int i = 0; i < _mappingPIs.Count; i++) { MappingPIComponent mappingPI = _mappingPIs[i] as MappingPIComponent; string mapping = "XmlNamespace=\"" + mappingPI.XmlNamespace + "\" ClrNamespace=\"" + mappingPI.ClrNamespace + "\" Assembly=\"" + mappingPI.Assembly + "\""; XmlNode piNode = xmlDocument.CreateProcessingInstruction("Mapping", mapping); xmlDocument.AppendChild(piNode); } }