We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everyone,
I am researching how to service XML file, so far managed to read a file generated, but I'm having trouble adding a record in an existing file, and also delete a specific item.
I'm looking for example ( addChild() ):
https://processing.org/reference/XML_addChild_.html
[code below]
As it would be to add another item? For example: Lions
One more thing, as I would to delete a specific item?
For example, to remove: Zebra
I hope you understood any help, I thank you.
Answers
Sorry, no marked the text code ...
here is the idea
problem is, you need to find the highest id and then go on from here to write new ids....
;-)
you can write a function for the animal
Hello,
Thanks for return now "cleared" how can I do, I will adapt as my need ...
Thank you very very much,
att,******** :)
Hello, Chrisir,
At times you will need to remove a specific item, how could I do that?
For example, removing item:
<animal id="1" species="Panthera pardus">Leopard</animal>
Example on the site explains how to remove first on the list, not a specific one.
Many thanks again
I managed only with a for-loop
should be possible with a
xml.getChildren("animal");
orxml.getChildren("animal/Zebra");
but didn't work
OK,
but asssim is very good, I can solve the problem ... thanks a lot, and thanks! :)
great
Hello again,
I have a "little big" problem to complete part of the project, I will try to explain.
The Project "set up" the menu to videos for each patient, ie a therapist can add options for videos (favorites) for each patient, so that it can use more easily through some device like the Kinect and the Leap Motion as they are for guests with limited mobility ...
Obs .: clipped the photo image of the patient, to preserve the identity ...
My problem is as follows:
When you remove the link (button image), associated with an XML file, update all OK, that is, exclude the image and update the XML file in this case I would only need to make the button clicked stay invisible or could remove even the animation.
The problem is dynamically set up, ie the number of images may vary, as already adicionao for each patient.
You have a discussion on this link, passing an idea about it, but in this case is only one button:
Link: http://forum.processing.org/one/topic/controlp5-show-and-hide.html
In my case I had a "list" buttons, would have to have a means of identifying which really I clicked.
I thought to create the objects in the form of Array (in this case I'm using the Controlp5 library), and thus control each according to delete.
I hope you had understand, any hint, I thank you.
Code Project: ( Only remove Item )
I'll leave the other part of the project as well, which can be useful for someone that can be adapted to build a menu with users or play for certain games, or other purposes.
May not work because the files that need to load the Project (XML and TXT), I am leaving the print to get an idea of how it is.
Thank you,
The images of how it's getting the project:
I don't have time, sorry
Hello, do not apologize for it, always grateful for the help I have in the forum ...
Then I got a solution for when you remove the link, make the button is invisible, and when reload the menu, as it is no longer in the XML file, no longer appears in the menu.
Need to replace this part of the code:
Thank you for now, until the next challenge ... (laughs)
Thank you
I thought about leaving the use of the program, ie in this program records the menus for each user, and in another, where other options, use what has been registered in this but do not know if it would be good idea ...
If anyone needs something along those lines, and just leave any notification, which put the code here ...
Thank you
This is the print images, use the program ...
Obs .: I covered the images to preserve the identity of the patients ... Source of Images: Google Images att,