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. C / C++ / MFC
  4. How to Read/Write schema file .xsd in c++

How to Read/Write schema file .xsd in c++

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedata-structuresxmltutorial
8 Posts 3 Posters 1 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.
  • B Offline
    B Offline
    brraj
    wrote on last edited by
    #1

    I want to create schema file xsd file programmatically in c++ so that i can add validation information for each element and read back the tree structure with validation. Is this possible in c++?

    L J 2 Replies Last reply
    0
    • B brraj

      I want to create schema file xsd file programmatically in c++ so that i can add validation information for each element and read back the tree structure with validation. Is this possible in c++?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Yes, of course it is possible, assuming that you understand how to create the schema in the first place. Take a look at some of the links at: create xsd schema - Google Search[^].

      B 1 Reply Last reply
      0
      • B brraj

        I want to create schema file xsd file programmatically in c++ so that i can add validation information for each element and read back the tree structure with validation. Is this possible in c++?

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        That seems a bit odd. The normal process for using an xsd would be as follows. 1. Create the xsd manually. 2. Create program to accept xml as input 3. Validate the input from 2 using 1. Nothing it the above really has anything to do with a "tree'. One can use the xsd to automatically generate classes which can be used to parse and consume the input. At least in my experience validating the input that way (exclusively in terms of the xsd) doesn't lead to very useful errors. However using the xsd itself as a input along with the xml leads to better errors. But that could have had to do with the generation framework that I was using.

        B 1 Reply Last reply
        0
        • L Lost User

          Yes, of course it is possible, assuming that you understand how to create the schema in the first place. Take a look at some of the links at: create xsd schema - Google Search[^].

          B Offline
          B Offline
          brraj
          wrote on last edited by
          #4

          I wanted to programmatically create/read xsd file in c++? We have lot of tools to generate xsd from xml and vice versa... We also have lot of example in .net but wanted it in c++ code. I am using msxml6 to parse xml files and wanted to do the same for xsd files aswell.

          L 1 Reply Last reply
          0
          • J jschell

            That seems a bit odd. The normal process for using an xsd would be as follows. 1. Create the xsd manually. 2. Create program to accept xml as input 3. Validate the input from 2 using 1. Nothing it the above really has anything to do with a "tree'. One can use the xsd to automatically generate classes which can be used to parse and consume the input. At least in my experience validating the input that way (exclusively in terms of the xsd) doesn't lead to very useful errors. However using the xsd itself as a input along with the xml leads to better errors. But that could have had to do with the generation framework that I was using.

            B Offline
            B Offline
            brraj
            wrote on last edited by
            #5

            This is my task in vc++ - To create GUI for user to add tree structure where each tree node can contain attribute, restrictions etc.. - Once user configures we write it to xsd files. - If user want to alter he reopens xsd file and alters any properties of xsd file. possible?

            J 1 Reply Last reply
            0
            • B brraj

              I wanted to programmatically create/read xsd file in c++? We have lot of tools to generate xsd from xml and vice versa... We also have lot of example in .net but wanted it in c++ code. I am using msxml6 to parse xml files and wanted to do the same for xsd files aswell.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Fine, that is what you want. But what problem are you having with your code?

              B 1 Reply Last reply
              0
              • L Lost User

                Fine, that is what you want. But what problem are you having with your code?

                B Offline
                B Offline
                brraj
                wrote on last edited by
                #7

                I am unable to write c++ code to parse XSD files. Very less resources to begin with.

                1 Reply Last reply
                0
                • B brraj

                  This is my task in vc++ - To create GUI for user to add tree structure where each tree node can contain attribute, restrictions etc.. - Once user configures we write it to xsd files. - If user want to alter he reopens xsd file and alters any properties of xsd file. possible?

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #8

                  brraj wrote:

                  possible?

                  Of course. An XSD is just an XML file with a certain format. So map the 'attributes' allowed in your app to appropriate constructs in an XSD. You generate the xsd using the same framework that you would for xml.

                  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