add xml validation schema in the xml file

G

Guest

Hi, All,

I want to add xml validation schema namespace attribute for AutoData root
node(xsi:noNamespaceSchemaLocation="C:\AutoDataSchema.xsd")in the following
file

<AutoData >
<Table1>
<Data1> 10 </Data1>
<Data2> 20 </Data2>
<Data3> 40 </Data3>
<Table1>
</AutoData>

So finally the file with valiation schema namespace is like this:

<AutoData xsi:noNamespaceSchemaLocation="C:\AutoDataSchema.xsd">
<Table1>
<Data1> 10 </Data1>
<Data2> 20 </Data2>
<Data3> 40 </Data3>
<Table1>
</AutoData>

Anyone knows how to add it?

Thanks
Martin
 
M

Martin Honnen

martin1 said:
I want to add xml validation schema namespace attribute for AutoData root
node(xsi:noNamespaceSchemaLocation="C:\AutoDataSchema.xsd")in the following
file
<AutoData xsi:noNamespaceSchemaLocation="C:\AutoDataSchema.xsd">

But why did you want to remove the xmlns:xsi namespace declaration in an
earlier post? That does not make sense, you cannot simply have the
xsi:noNamespaceSchemaLocation attribute without having xmlns:xsi
declared properly.

As for adding an attribute look into the SetAttribute method on XmlElement.
 
G

Guest

Hi, Martin,

when I add attibute <xsi:noNamespaceSchemaLocation="C:\AutoDataSchema.xsd">
using SetAttibute, it drop "xsi:" and just add
<noNamespaceSchemaLocation="C:\AutoDataSchema.xsd">, do you know why?

Thanks for your time

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top