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. Reading XML Schema and schemas located in Includes

Reading XML Schema and schemas located in Includes

Scheduled Pinned Locked Moved XML / XSL
xmlcsharpdatabase
1 Posts 1 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.
  • V Offline
    V Offline
    ValAkkapeddi
    wrote on last edited by
    #1

    I'm writing a C# app to document the types of XmlSchemaComplex types... I have a schema file containing complexTypes, and those complexTypes have elements which are of other complexTypes, located in another file that I'm including into my outer schema file. I'm reading the schema file, going into the complexTypes, and trying to read the types of the sub-elements that are of the sub-types. However, the type attributes of the elements inside my main complexTypes are set to nulls, although the SchemaTypeText is filled out with the current type name and namespace. The code that I'm using looks a little something like this (please pardon the horrendous noobishness): XmlTextReader schemaReader = new XmlTextReader(schemaPath); XmlSchema schema = XmlSchema.Read(schemaReader, null); foreach (XmlSchemaObject xso in schema.Items) { if (xso is XmlSchemaComplexType) { XmlSchemaComplexType rootType = xso as XmlSchemaComplexType; if (rootType.Particle is XmlSchemaSequence) { XmlSchemaSequence rootseq = (XmlSchemaSequence)rootType.Particle; foreach(XmlSchemaObject ixso in rootseq.Items) { if (ixso is XmlSchemaElement) { XmlSchemaElement ele = ixso as XmlSchemaElement; XmlSchemaType eleType = ele.SchemaType; // this is null string typTxt = ele.SchemaTypeText; // this right, but strings. } } } } If I can get the part about accessing the element types of the nested elements in my complexTypes right, I want to pass those complexTypes into a recursive method that'll enumerate all the members of the inner complexTypes for me, etc.

    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