我所要的輸出是這樣的:XmlDocument的附加空間前綴
<Order xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gml="example.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="example.com http://schemas.xyz.net/gml/2.1.2/feature.xsd"
xsi:noNamespaceSchemaLocation="http://www.xyz.co.uk/xmlorders3/lig_xml_orders.xsd">
的代碼,我用得到這個是:
xmlDocument.DocumentElement.SetAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema");
xmlDocument.DocumentElement.SetAttribute("xmlns:gml", "example.com");
xmlDocument.DocumentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
xmlDocument.DocumentElement.SetAttribute("xsi:schemaLocation", "example.com http://schemas.opengis.com/gml/2.1.2/feature.xsd");
xmlDocument.DocumentElement.SetAttribute("xsi:noNamespaceSchemaLocation","http://www. xyz.co.uk/xmlorders3/lig_xml_orders.xsd");
但我得到的輸出喜歡這:
<Order xmlns:gml="example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
schemaLocation="example.com http://schemas.xyz.net/gml/2.1.2/feature.xsd"
noNamespaceSchemaLocation="http://www.xyz.co.uk/xmlorders3/lig_xml_orders.xsd">
請建議我任何其他方式來獲得所需的輸出。
請參見[56,「問題包括‘’?在他們的標題」標籤(http://meta.stackexchange.com/questions/19190/應該包括標題中的問題),其中的共識是「不,他們不應該」! – 2015-03-25 09:31:26