add xml validation schema in the xml file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • martin1

    #1

    add xml validation schema in the xml file

    Hi, All,

    I want to add xml validation schema namespace attribute for AutoData root
    node(xsi:noName spaceSchemaLoca tion="C:\AutoDa taSchema.xsd")i n 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:noNamespace SchemaLocation= "C:\AutoDataSch ema.xsd">
    <Table1>
    <Data1 10 </Data1>
    <Data2 20 </Data2>
    <Data3 40 </Data3>
    <Table1>
    </AutoData>

    Anyone knows how to add it?

    Thanks
    Martin

  • Martin Honnen

    #2
    Re: add xml validation schema in the xml file

    martin1 wrote:
    I want to add xml validation schema namespace attribute for AutoData root
    node(xsi:noName spaceSchemaLoca tion="C:\AutoDa taSchema.xsd")i n the following
    file
    <AutoData xsi:noNamespace SchemaLocation= "C:\AutoDataSch ema.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:noNamespace SchemaLocation attribute without having xmlns:xsi
    declared properly.

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

    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

    Comment

    • martin1

      #3
      Re: add xml validation schema in the xml file

      Hi, Martin,

      when I add attibute <xsi:noNamespac eSchemaLocation ="C:\AutoDataSc hema.xsd">
      using SetAttibute, it drop "xsi:" and just add
      <noNamespaceSch emaLocation="C: \AutoDataSchema .xsd">, do you know why?

      Thanks for your time

      Martin

      "Martin Honnen" wrote:
      martin1 wrote:
      >
      I want to add xml validation schema namespace attribute for AutoData root
      node(xsi:noName spaceSchemaLoca tion="C:\AutoDa taSchema.xsd")i n the following
      file
      >
      <AutoData xsi:noNamespace SchemaLocation= "C:\AutoDataSch ema.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:noNamespace SchemaLocation attribute without having xmlns:xsi
      declared properly.
      >
      As for adding an attribute look into the SetAttribute method on XmlElement.
      >
      --
      >
      Martin Honnen --- MVP XML
      http://JavaScript.FAQTs.com/
      >

      Comment

      Working...