How to edit attribute

18 views
Skip to first unread message

Ryan Airth

unread,
May 10, 2014, 3:06:00 PM5/10/14
to joox...@googlegroups.com
Hi,

I know someone else already asked pretty much the same thing.
And the answer was pretty much, to use ".attr(String name, String value)"

How ever I'm having a slight issue.

I'm not familiar with things like JQuery and such.
And this is

But what I'm trying to do is.
Edit the money value using a value given by the user.

Document document = $(file).document();
Match x = $(document).attr("money", Integer.toString(value));

Is the pretty much what I'm doing, nothing happens so I assume it's wrong or I'm missing something.

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<careerSavegame revision="1" valid="true" money="50000000" dayTime="400.194611" and a bunch of other stuff.....>
    Stuff I don't care about.....
</careerSavegame>

Please help.

Lukas Eder

unread,
May 12, 2014, 8:57:44 AM5/12/14
to joox...@googlegroups.com
Hi Ryan,

Do you mean the change is not persisted to the file? jOOX does not store anything to file by itself. If that's what you want, you'll have to explicitly serialise the XML content again.

Hope this helps,
Lukas


--
You received this message because you are subscribed to the Google Groups "joox-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joox-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Airth

unread,
May 13, 2014, 3:49:14 PM5/13/14
to joox...@googlegroups.com
Ah, right I see.

Does jOOX have anything that will let me save the file again, over-writing the original?
If not, how would I get the data, with the change, so I can save it to a new file?

Regards,
Ryan Airth

Lukas Eder

unread,
May 13, 2014, 4:53:35 PM5/13/14
to joox...@googlegroups.com
I would say, Match.write(File) would be along the lines of what you're looking for. :-)
Otherwise, Match.toString() also serialises XML content, if you prefer that.

Cheers
Lukas

Ryan Airth

unread,
May 13, 2014, 5:38:16 PM5/13/14
to joox...@googlegroups.com
Ok, thanks.

I'll come back if I have any more trouble, otherwise, thanks for the help.

Regards,
Ryan Airth


--
You received this message because you are subscribed to a topic in the Google Groups "joox-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/joox-user/oH9HPWH7JNw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to joox-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages