Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XML Validation in .NET 2.0 C#

XML Validation in .NET 2.0 C#

Scheduled Pinned Locked Moved XML / XSL
csharpxmlhelpdatabasevisual-studio
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SABhatti
    wrote on last edited by
    #1

    I am having a weird problem while validating an XML file against its schema. I am setting XmlReaderSettings to xml schema, add the ValidationEventHandler and then create the xml reader. But it throws an exception: ------------------ A first chance exception of type 'System.Xml.Schema.XmlSchemaValidationException' occurred in System.Xml.dll validate function threw an exception of type 'System.Xml.Schema.XmlSchemaValidationException' base {System.Xml.Schema.XmlSchemaException}: {"It is an error for both 'length' and either 'minLength' or 'maxLength' to be members of {facets}, unless they are specified in different derivation steps. In which case the following must be true: the {value} of 'minLength' <= the {value} of 'length' <= the {value} of 'maxLength'."} SourceObject: null ----------------------- I have validated the same xml file against the same schema using Oxygen XML Editor and XML Spy and these tools consider it a valid document. Now after that I opened the schema in VS 2005, it underlines the xsd:length attribute and tootip gives the same error. But the above mentioned third party tools consider it valid attribute. Any thoughts will be highly appreciated

    -----

    D 1 Reply Last reply
    0
    • S SABhatti

      I am having a weird problem while validating an XML file against its schema. I am setting XmlReaderSettings to xml schema, add the ValidationEventHandler and then create the xml reader. But it throws an exception: ------------------ A first chance exception of type 'System.Xml.Schema.XmlSchemaValidationException' occurred in System.Xml.dll validate function threw an exception of type 'System.Xml.Schema.XmlSchemaValidationException' base {System.Xml.Schema.XmlSchemaException}: {"It is an error for both 'length' and either 'minLength' or 'maxLength' to be members of {facets}, unless they are specified in different derivation steps. In which case the following must be true: the {value} of 'minLength' <= the {value} of 'length' <= the {value} of 'maxLength'."} SourceObject: null ----------------------- I have validated the same xml file against the same schema using Oxygen XML Editor and XML Spy and these tools consider it a valid document. Now after that I opened the schema in VS 2005, it underlines the xsd:length attribute and tootip gives the same error. But the above mentioned third party tools consider it valid attribute. Any thoughts will be highly appreciated

      -----

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #2

      See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1590647&SiteID=1[^].


      "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups