Devo creare un documento XML in C#.Come aggiungere uno spazio dei nomi durante la creazione di un file XML?
elementoLa radice deve assomigliare a questo:
<valuation-request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="valuations.xsd">
Sto utilizzando il seguente
XmlElement root = X.CreateElement("valuation-request");
root.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
root.SetAttribute("xsi:noNamespaceSchemaLocation", "valuations.xsd");
Tuttavia questo produce
<valuation-request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
noNamespaceSchemaLocation="valuations.xsd"> //missing the xsi:
Che cosa mi manca?
sto usando root.SetAttribute ("xsi: noNamespaceSchemaLocation", "valuations.xsd") ;. come suggeriresti che dovrebbe apparire? – Steven
provare questo root.SetAttribute ("noNamespaceSchemaLocation", "valuations.xsd", "http://www.w3.org/2001/XMLSchema-instance"); –
Che restituisce –
Steven