Using XMLDB editor

Using XMLDB editor

by Peter Mott -
Number of replies: 13
If you are just starting the development of a module and want to use the XMLDB editor what is the best way to proceed?

Thanks

Average of ratings: -
In reply to Peter Mott

Re: Using XMLDB editor

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It should be possible to start from http://docs.moodle.org/en/Development:XMLDB_Documentation.

However, there is a lot of documentation there, and I am not sure how easy it is for a beginner to know where to start.

As you try to understand the documentation, your comments on how it could be improved would be appreciated.
In reply to Tim Hunt

Re: Using XMLDB editor

by Peter Mott -
Well my present issue is that I want to develop an activity module called, say, myModule. At present no files exist. I want to use the XMLdb editor to create an install.php file for this module. But when I open it in Moodle (1.8) I am presented with a list of existing modules and various option over them. I could not find anything in the docs about starting development. One difficulty is I can't find a distinction between documentation about how to use the XMLdb editor and documentation relating to its development(eg "The next stack shows how Moodle 1.7 code will interact with underlying RDBMS").
In reply to Peter Mott

Re: Using XMLDB editor

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You need to make sure the mymodule/db folder exists and is readable by the web server, then you should be able to get started.
In reply to Tim Hunt

Re: Using XMLDB editor

by Scott Karren -
So I am using the XMLDB editor to add fields to a couple of tables. I have followed the documentation and have created the new fields, but I see no where that I can actually save the new structure. I backed out to the main screen and all I have available to me is Edit, the Save link is not active. Am I missing something here?

Scott Karren
In reply to Peter Mott

Re: Using XMLDB editor

by Angela Roberts -
I am sure that this is the stupidest question on the planet.

But can someone tell me what the XMLDB editor is and how I can make use of it.

I saw it there when I was making a database and I was sure it could e useful....but I am at a loss as to how to leverage it.

Sorry for the "dummies" question. But a real dummies answer that also advances into an advanced answer would really be appreciated.

Thanks!

angela
In reply to Angela Roberts

Re: Using XMLDB editor

by Valery Fremaux -

The XMLDB editor is a tool to produce as easily as it is possible the messy XML required by the new installation procedure. Considering writing databse scheme with XML is a real pleasure (!!) spending twice to four time the time you needed forextracting your SQL model. So here is the XMLDB Editor that helps you to extract from your DB the ugly and ultra-verbose, largely redundant XML code.

The best way to procede is to make your entire model in MySQL, arrange it, tune it and fix it, then using the XMLDB Editor to make the XML by creating the install.xml, then importing one by one the tables. Care that the first table of the module is imported when creating the XML at first but with a bug that only recognizes the "id" field, forgetting the others. You may import a second table, then delete the first one, and get it back to read all fields. XMLDB Editor allows you to rearrange entities in the order you would like they appear in the XML file.

You should closely check the XML as there are some type miscoding (such as integer turning into text fields, forgotten DEFAULTS, say, some little inconsistencies, but the major part of the work is done). Don't forget writing XML code back when finished arranging fields.

In reply to Angela Roberts

Re: Using XMLDB editor

by Peter Mott -
The way I used it was to create a folder mod/myModule/db that was writable by the Webserver. Then go into Moodle XMLDB editor and select mod/myModule and use [create] then [load] then [edit]. Then you start creating and editing a table. It is quite intuitive once you are in. There is one gotcha which is that to save your stuff you must backtrack all the way out and use [save]. Moodle will then write your install.xml which you can use. Oh yes, it seems that Moodle requires a Comment for the table.


Average of ratings: Useful (1)
In reply to Peter Mott

Re: Using XMLDB editor

by Aaron Wells -
I guess I'm a little late to the conversation sleepy, but I thought I'd mention that I just went through some difficulty figuring out how to get started with the XMLDB Editor as well. After figuring it out from this forum thread, I put up essentially these same instructions on the wiki: http://docs.moodle.org/en/XMLDB_editor#Quick_Start
Average of ratings: Useful (1)
In reply to Aaron Wells

Re: Using XMLDB editor

by Souman Mandal -

Hi All,

I am developing an Activity module named rubrics. But I am unable to modify the basic database table of the module. I want to add one filed named 'rowno' into the mdl_rubrics table. So using the XMLDB editor I edited the table and add the field. Then followed the instructions from different tutorial to update the change. And the notification I am getting is rubrics tables have been set up correctly. But when I am viewing the database using the command select * from mdl_rubrics; new field is not showing there. Plz help me how to add this new field.

Thanks,

Souman

In reply to Souman Mandal

Re: Using XMLDB editor

by Souman Mandal -

May be this is a very basic question, but I am really unable to figure out the purpose of XMLDB editor in Moodle. To be specific I need answers to the following questions

  • Can we use it to add a new field of a existing table?
  • If yes how?
  • Why not use PHPMyAdmin?

Waiting for some replies,

Souman

In reply to Souman Mandal

Re: Using XMLDB editor

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The XMLDB editor is designed for developers developing new plugins or core functionality. If you read something like the NEWMODULE tutorial, or Development:Installing_and_upgrading_plugin_database_tables it should become clear.

If it is not clear, don't use it wink

In reply to Tim Hunt

Re: Using XMLDB editor

by Souman Mandal -

smile .... Now it is clear to me, so started using it. I was having some problem with the version number.

Thanks for your reply Tim