Tengo que crear un documento XML en C#.¿Cómo agrego un espacio de nombres al crear un archivo XML?
elementoLa raíz tiene que tener este aspecto:
<valuation-request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="valuations.xsd">
estoy usando el siguiente
XmlElement root = X.CreateElement("valuation-request");
root.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
root.SetAttribute("xsi:noNamespaceSchemaLocation", "valuations.xsd");
Sin embargo, esto produce
<valuation-request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
noNamespaceSchemaLocation="valuations.xsd"> //missing the xsi:
¿Qué me falta?
estoy usando root.SetAttribute ("xsi: noNamespaceSchemaLocation", "valuations.xsd") ;. ¿Cómo sugerirías que debería verse? – Steven
intente con este root.SetAttribute ("noNamespaceSchemaLocation", "valuations.xsd", "http://www.w3.org/2001/XMLSchema-instance"); –
Que devuelve –
Steven