Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans on adding a schema for modDesc.xml? #12

Open
LukeV1 opened this issue Oct 31, 2021 · 5 comments
Open

Any plans on adding a schema for modDesc.xml? #12

LukeV1 opened this issue Oct 31, 2021 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed schema Issue/PR is relavent to the schema files

Comments

@LukeV1
Copy link

LukeV1 commented Oct 31, 2021

Hi there,
I'm back again with another question.. But first of all a big thank you for publishing this repo! It has a lot of potential to ease out mod development!

Details

Each mod must contain a modDesc.xml file, containing basic information about the mod and its storeItems. It would be great if there is also a validation schema for this file!

@LukeV1 LukeV1 added enhancement New feature or request needs-triage This bug still needs to be triaged schema Issue/PR is relavent to the schema files labels Oct 31, 2021
@marsfan marsfan added help wanted Extra attention is needed and removed needs-triage This bug still needs to be triaged labels Nov 2, 2021
@marsfan
Copy link
Owner

marsfan commented Nov 2, 2021

It would be great to have one. I don't really have the time to work on it right now, but if you want to get started on documenting the different elements of the XML file, it would greatly help out!

@LukeV1
Copy link
Author

LukeV1 commented Nov 3, 2021

I migth give it a shot.. But as you know most of it is barely documented - which is the very reason for this repository to exist :D
How should I document it? Directly as a xsd file? (would be a good reason for me to finally try to understand them..)

@LukeV1
Copy link
Author

LukeV1 commented Nov 6, 2021

Update: I created a modDesc.xsd files from original GIANTS files.
Sources used:

  • sample mod map (ships with FS installation)
  • precision farming mod

I choose them on purpose because they cover maps, vehicles, placeables and more specialized mod functions ("scripts").

After fetching them with trang I used your refRemover.py script (very cool!) to flatten out the xsd file structure. The output looks quite good (see bottom).


BUT one thing puzzles me: the xsd schema don't seem to replicate the exact xml hierarchy (I also noticed this in other files): when opening the file in VisualStudio2015 (my xsd validator ;) it shows the xsd elements hierachy:
grafik
...which shows quite a few items on the top level - while all real modDesc.xml-files only have one element in the root: <modDesc>! So I wonder what trang is doing there?? 🤔


Below is my generated xsd file: packed as zip, since direct xsd upload is not allowed on github
modDesc.zip

@marsfan
Copy link
Owner

marsfan commented Nov 7, 2021

@LukeV1 Cool. Its been a while since I worked on this, so I can't remember how everything works TBH. XSD files are kinda scary.

What do you mean about XSD not being uploadable through GitHub? Can you not fork this repo and make your own fork with the changes?

I believe the reason that you are seeing multiple top level items is because some elements are used in more than one place, so they are placed in the top level and re-used multiple times.
Essentially, everything you see at the top level (other than modDesc is a global variable, that is referenced inside modDesc

For example, there are two title elements in the mod description. One is right below modDesc, while the other is below maps.

To save space, the title element is placed at the top level, and then referenced from both points.

I would also recommend you use a couple of different types of mods. Since both mods you used are for maps, the generated XSD will only contain elements necessary to define a map mod.

@LukeV1
Copy link
Author

LukeV1 commented Nov 11, 2021

What do you mean about XSD not being uploadable through GitHub? Can you not fork this repo and make your own fork with the changes?

I just referred to attaching the file to a comment here. But you are right, I am supposed to fork it. I'll do that in the next days.

XSD files are kinda scary.

I noticed that :D.
This reference-mechanism may also explain the (seemingly) different hierarchy. But right now I am not fully convinced, because the XSD root-Tags de or en are language tags - but there are a ton of other languages also aviable which didn't get an entry on the top level.. I will have to dig further into this.

I would also recommend you use a couple of different types of mods. Since both mods you used are for maps, the generated XSD will only contain elements necessary to define a map mod.

Actually I did this as mentioned in my last comment above:

I choose them on purpose because they cover maps, vehicles, placeables and more specialized mod functions ("scripts").

These files where the only ones I was 100% sure they were from GIANTS and therefore (hopefully!) follow their xml-guidelindes. Wich was the main reason I didn't run much more mods through trang for xsd generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed schema Issue/PR is relavent to the schema files
Projects
None yet
Development

No branches or pull requests

2 participants