--- doc/homework/xml.html 2002/05/23 21:17:19 1.4
+++ doc/homework/xml.html 2002/10/21 20:31:06 1.7
@@ -23,7 +23,8 @@
$Apache::lonxml::debug - debugging control
- @Apache::lonxml::pwd - path to the directory containing the file currently being processed
+ @Apache::lonxml::pwd - path to the directory containing
+ the file currently being processed
@Apache::lonxml::outputstack
@@ -41,12 +42,12 @@
(images, and links)
- #Apache::lonxml::metamode - some output is turned off,
+ $Apache::lonxml::metamode - some output is turned off,
the meta target wants a specific subset, use <output> to
guarentee that the catianed data will be in the parsing output
- #Apache::lonxml::evaluate - controls whether
+ $Apache::lonxml::evaluate - controls whether
run::evaluate actually derefences variable references
@@ -66,15 +67,67 @@
$Apache::lonxml::request - current Apache request
object, or undef
+
+ $Apache::lonxml::curdepth - current depth of the
+ overall parse depth. Will be a string like: 2_3_1 (first tag
+ in the third second level tag in the second toplevel tag). It
+ gets set by callsub, and can be used in Perl tag
+ implementations. It relies upon the internal globals:
+ @Apache::lonxml::depthcounter,
+ $Apache::lonxml::depth,
+ $Apache::lonxml::olddepth
+
+
+ $Apache::lonxml::prevent_entity_encode - By default the
+ xmlparser will try to rencode any 8-bit characters into HTML
+ Entity Codes, If this is set to a true value it will be
+ prevented.
+
+
+ $Apache::lonxml::errorcount - keeps count of the number
+ of errors generated in a parse
+
+
+ $Apache::lonxml::warningcount - keeps count of the
+ number of errors generated in a parse
+
+
+ $Apache::lonxml::counter
+ $Apache::lonxml::counter_changed - a counter used to
+ keep track of the number of questions asked, used currently to
+ track bubble numbers, Initialized off of $ENV{'form.counter'},
+ and writes this value to the environment if counter_changed is
+ true, should use the &increment_counter() function to
+ increment this value.
+
+
+ $Apache::lonxml::default_homework_loaded - a boolean on
+ wherethe the default_homework.lcpm file has been loaded into
+ the Safe Space, the function
+ &Apache::lonxml::default_homework_load()
+
-
+
+
+ In common usage, $Apache::lonxml::prevent_entity_encode,
+ $Apache::lonxml::evaluate,
+ $Apache::lonxml::metamode,
+ $Apache::lonxml::import, should never be set to a value
+ directly, but rather incremented when you want the effect on,
+ and decremented when you want the effect off.
+
+
Notable Perl subroutines
If not specified these functions are in Apache::lonxml
-
- xmlparse - see the XMLPARSE figure
+ xmlparse - see the XMLPARSE figure - also not callable
+ from inside a tag, if one needs to restart parsing, either
+ create add a new LCParser to the parser stack parser using the
+ newparser function, or call inner_xmlparser, see the xmlparse
+ function in scripttag.pm
-
recurse - acts just like xmlparse, except it
@@ -105,6 +158,17 @@
for this setup. Uses form.grade_ parameters, if the user is
allowed to mgr in the course
+ -
+ setup_globals - initializes all lonxml globals when
+ xmlparse is called. If you intend to create a new target you
+ will likely need to tweak how the globals are setup upon start
+ up.
+
+ -
+ init_safespace - creates Holes to external functions,
+ creates some global variables, and set the permitted operators
+ of the global Safespace intepreter.
+
Functions Tag Handlers can use
@@ -137,14 +201,48 @@
Apache::scripttag::start_script for an example of usage.)
- get_param - 4 arguments, firsth is a scaler sting of
+ get_param - 4 arguments, first is a scaler sting of
the argument needed, second is a reference to the parser
arguments stack, third is a reference to the Safe space, and
fourth is an optional "context" value. This subroutine allows
a tag to get a tag argument, after being interpolated inside
the Safe space. This should be used if the tag might use a
safe space variable reference for the tag argument. (See
- Apaceh::scripttag::start_script for an example.)
+ Apache::scripttag::start_script for an example.)
+
+ This version only handles scalar variables.
+
+
+ get_param_var - 4 arguments, first is a scaler sting of
+ the argument needed, second is a reference to the parser
+ arguments stack, third is a reference to the Safe space, and
+ fourth is an optional "context" value. This subroutine allows
+ a tag to get a tag argument, after being interpolated inside
+ the Safe space. This should be used if the tag might use a
+ safe space variable reference for the tag argument. (See
+ Apache::scripttag::start_script for an example.)
+
+ This version can handle list or hash variables properly.
+
+
+ description - 1 argument, the token object. This will
+ return the textual decription of the current tag from the
+ insertlist.tab file.
+
+
+ whichuser - 0 arguments. This will take a look at the
+ current environment setting and return the current $symb,
+ $courseid, $udom, $uname. You should always use this function
+ if you want to determine who the current user is. (Since a
+ instructor might be trying to view a students version of a
+ resource.)
+
+
+ inner_xmlparse - 6 arguments, the target, an array
+ pointer to the current stack of tags, and array pointer to the
+ current stack of tag arguments, an array pointer to the
+ current stack of LCParser's, a pointer to the current Safe
+ space, a pointer to the hash of current style definitions
newparser - 3 args, first is a reference to the parser
@@ -165,7 +263,14 @@ sub BEGIN {
}
Would tell xmlparse that in Apache::scripttag it can find
- handlers for <script> and <display>
+ handlers for <script> and <display>, if one
+ regsiters a tag that was already registered the previous one
+ is remembered and will be restored on a deregister.
+
+
+ deregister - used to remove a previously registered tag
+ implementation. It will restore the previous registration if
+ there was one.
startredirection - used when a tag wants to save a
@@ -184,7 +289,7 @@ sub BEGIN {
a reference to the Safe space, 3 a string to be evaluated
before the first arg. This subroutine will do variable
interpolation and simple function interpolations on the first
- argument. (See Apache::lonxml::xmlparse for an example.)
+ argument. (See Apache::lonxml::inner_xmlparse for an example.)
Apache::run::run - 2 args, first a string, second a
@@ -220,7 +325,7 @@ sub BEGIN {
Guy Albertelli
-Last modified: Thu May 23 17:19:29 EDT 2002
+Last modified: Mon Oct 21 16:41:56 EDT 2002