String getXML(String objName) void setXML(String xmlString)

SharkD shared this question 1 month ago
Answered

Per this article:

https://wiki.geogebra.org/e...

Could anyone explain how these functions work? Could you provide a usage example? Can I get and set individual XML objects within the drawing?

Thanks.

Comments (4)

photo
1

With get/eval xml you can read or write in JS all properties of any existing object.

Two questions: what do you want to use it for (concretely)? And why is it not possible with ggb-scripts?

photo
1

Mainly I am looking for alternative ways of setting the window and drawing area dimensions, as well as the scale of the axes/coordinate system/etc. since normally you either 1. cannot do this using ggb scripts, 2. have to use a menu to do it, or 3. have to use a (relatively) more complicated series of commands and constructions.

For instance, AFAIK, GeoGebra has never since the beginning had any way to set the size of the window or drawing area without resorting to using JS or editing the XML.

I create illustrations for Wikipedia (and other artwork) and am *very* particular about the exact dimensions of my constructions.

I understand and have been told explicitly by Markus that if a feature does not benefit educators or students directly then it is not a priority; but for *me* personally it is a major annoyance.

photo
1

I still don't understand exactly how to use these getter/setter methods. Could you provide a usage example?

photo
1

I have little experience with the aspects of xml and JS that are primarily relevant to you.

What might be of interest for you rather than xml is deposited here and here. Unfortunately, I also have no experience with it.

As an attachment an example for the handling of ggb-objects with JS and XML. The documentation is basically stored in the JS-scripts themselves. I'm happy to answer questions about this (and hope I can still remember)

© 2021 International GeoGebra Institute