I need to read an XML object wiin an XML file, and then i should take out the specific parts of the XML object for showing to a specific text fields of a panel in my editor window.
I want to take out those text in between
different tags and shows them in specific text fields on my editor window, for example OpePr1:=… ;OpePr2:=…;
should be shown in the first field and the texts “OpBh1:=…; OpBh2:=…;…” in the second field . ExCon1:=…;
ExCon2:=…; in the next field and so on so forth,
First, going from complete **string **
which has been stored as XML object , to separate lists including OpPre1,OpePre2,…
, and then OpeBeh1,OpeBeh2,… etc,to strings, which each must be viewed
in the specific parts of editor windows is what i intend to do.
second after editing the text in my editor window, i should be able to save to the same place that i have been loaded the text in .xml file!
I would be great if some body have idea on how i can solve this problem.
I need to read an XML object wiin an XML file, and then i should take out the specific parts of the XML object for showing to a specific text fields of a panel in my editor window.
I want to take out those text in between different tags and shows them in specific text fields on my editor window, for example OpePr1:=.. ;OpePr2:=....;
should be shown in the first field and the texts "OpBh1:=....; OpBh2:=..;....." in the second field . ExCon1:=..; ExCon2:=..; in the next field and so on so forth,
First, going from complete *string * which has been stored as XML object , to *separate lists *including OpPre1,OpePre2,... , and then OpeBeh1,OpeBeh2,... etc,to* strings*, which each must be viewed in the specific parts of editor windows is what i intend to do.
second after editing the text in my editor window, i should be able to save to the same place that i have been loaded the text in .xml file!
I would be great if some body have idea on how i can solve this problem.
You are probably best of using one of the XML tools to do the parsing for you.
I use amara and I am very happy with it.
There is also elementree I think this is part of Python as of 2.5 or 2.6 and lxml (http://codespeak.net/lxml/)
E.g. with amara after loading the xml file I just do:
"wine" above is an element in the XML file or "name" is an element/attribute of "wine" in that same document etc etc.
the xmlToTextCtrl is just a method which ensures that the length is respected (40 in the above) and put an error into a log if this is not the case or e.g. if "name" is not present in the XML which is a mandatory element ('True' on the 5th parameter).