Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
Pages: 1
colleagues:
i would like to create a simple .xml file format with scol, one that just contains a scene name string and string representing the url of a .mesh file:
<scene>scenename, type S </scene>
<mesh>http://www.ifam.net/mesh.mesh, type S</mesh>
</scene>
how would I use scol to write this file? I've looked over the api, but the way it is implemented in the editor is a bit too complicated for me to understand.
-h
Offline
You can use the xmlparser from os3D lib or directly the xml API : http://redmine.scolring.org/projects/sx … psxml.html
using the lib :
let XMLcreate file nil -> xmlstr in
let XMLaddMark xmlstr "scene" nil ["name" "scene name"]::nil nil -> scenestr in
let XMLaddMark xmlstr "mesh" scenestr nil "http://www.ifam.net/mesh.mesh"-> meshstr in
XMLSave xmlstr file;
Offline
Thx
Offline
Thx
here is code I wrote to save a simple xml file, with two parameters. each is a child of a scene parameter. this writes the file:
<scene minfps="12"/>
<scene maxpaksize="5"/>
here is the code:
proto XMLload = fun [S] XMLfile;;
proto XMLcreate = fun [S S] XMLfile;;
proto XMLaddMark= fun [XMLfile S XMLmark [[S S] r1] S] XMLmark;;
proto XMLwrite = fun [XMLfile S] I;;
//typeof file = XMLfile;;
fun secureLoad(pack)=
let _testpak pack -> ret in
if (ret == nil) then
(
_fooS "xmlparser loading";
_load pack;
1;
)
else
(
_fooS strcat "Error in " ret;
0;
);;
fun load_dependencies() =
let "tools/os3dlib/tools.pkg"::"tools/os3dlib/xmlparser.pkg"::nil -> list_of_dependencies in
(
while (list_of_dependencies!= nil)&& (secureLoad hd list_of_dependencies) do
(
set list_of_dependencies = tl list_of_dependencies;
_fooS "dependencies loading";
);
//all dependencies have been read
if list_of_dependencies==nil then
(
//read hybridgui.xos and write to hybridgui.xml in openspace3d/tests/filreader
let "xmlwriter/xmlwriter.xml" -> file in
let XMLcreate file nil -> xmlstr in
let XMLaddMark xmlstr "scene" nil ["minfps" "12"]::nil nil -> namestr in
let XMLaddMark xmlstr "scene" nil ["maxpaksize" "5"]::nil nil -> paksizestr in
//let XMLaddMark xmlstr "mesh" scenestr nil "http://www.ifam.net/mesh.mesh"-> meshstr in
(
XMLwrite xmlstr "xmlwriter/xmlwriter.xml";
);
0;
)
else
(
_fooS "error in dependency loading";
0;
);
);
0;;
fun main ()=
_showconsole;
load_dependencies;
0;;
thx for your help, it works
Offline
it has confusing comments in it..when I get my project going I have some cleaning up to do.
Offline
All the code for that is in the post about config file :
fun getConfigParam(type, pname)=
let XMLgetMarkByValue xmlConfigFile "config" -> configmark in
let XMLgetMarkByValueFromMarkSons configmark type -> typemark in
let XMLgetMarkByValueFromMarkSons typemark pname -> pmark in
XMLgetParam pmark "value";;
Offline
All the code for that is in the post about config file :
fun getConfigParam(type, pname)= let XMLgetMarkByValue xmlConfigFile "config" -> configmark in let XMLgetMarkByValueFromMarkSons configmark type -> typemark in let XMLgetMarkByValueFromMarkSons typemark pname -> pmark in XMLgetParam pmark "value";;
thx, I will try to figure this out.
Offline
I'm answering in the thread about reading an .xml file.
Offline
Pages: 1