papayaparadise 0 Newbie Poster

Hi,

I'm trying to generate an XML file with the following lines looking like:

<?xml version="1.0" encoding="UTF-8"?>
<Platform xmlns:xsi="http://www.w3.ord/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="theschema.xsd">

Platform is the root node. I need xsi:noNamespaceSchemaLocation for XML validation against the schema.

I've tried the following code (where xmlDoc is of type XmlDocument):

XmlElement Platform = xmlDoc.CreateElement("Platform");
Platform.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
Platform.SetAttribute("xsi:noNamespaceSchemaLocation", "theSchema.xsd");
xmlDoc.AppendChild(Platform);

... but that only gives me:

<Platform xmlns:xsi="http://www.w3.ord/2001/XMLSchema-instance" noNamespaceSchemaLocation="theschema.xsd">

Any advice is much appreciated - thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.