Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use XML Schema to Generate XML Documents
Forum Updated to NodeBB v4.3 + New Features

Use XML Schema to Generate XML Documents

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 894 Views
  • 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.
  • F Offline
    F Offline
    fcarney
    wrote on 10 Apr 2019, 15:28 last edited by
    #1

    I have an xml schema and an example xml document based on those schema. What I would like to do is create a way to read the schema and pattern document creation that would produce a valid xml document. So the schema directs what objects can be created.

    Here is the schema:
    schema

    Here is an example doc:
    example

    I would like to use Qt xml libraries if possible. One of the problems is this is so domain specific, and many of the documents rely on external sources of information. There are lots of namespace entries in that demo xml. I am just not sure if what I want to do is possible. I have found schema to C++ converters, but what happens if the schema changes in the future? I would like whatever solution I come up with to be dynamic and possibly support multiple versions of the schema.

    The main thing is I cannot get my head around how to use the schema in anything but a validation use case. I get that part. I realize I will have to make assumptions about datatypes, and thankfully there are datatypes already defined in documents related to this schema.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fcarney
      wrote on 10 Apr 2019, 17:08 last edited by fcarney 4 Oct 2019, 17:08
      #2

      Okay, I think I found the tool I was looking for.
      In Eclipse with the Web plugin you can literally right click on an xsd file and tell it to generate an xml file that, once it is generated you can add namespaces to the file. From there you can edit the file using a structured editor to add elements that correspond to the schema and various namespaces you added. This allows a structured creation of an xml file from the schema(s) you have selected. Eclipse will also keep validating against the schema so you will show errors if you enter in an incorrect node.

      So while initially I was looking for a programming solution, I was really looking for a suitably featured xml tool. I am sure there are others out there. I think visual studio has some tools for this.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      2

      1/2

      10 Apr 2019, 15:28

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved