--- doc/homework/xml.html 2001/05/21 03:35:46 1.1
+++ doc/homework/xml.html 2002/10/21 20:31:06 1.7
@@ -20,47 +20,114 @@
Global Variables
-
- Apache::lonxml::debug -
+ $Apache::lonxml::debug - debugging control
-
- Apache::lonxml::pwd -
+ @Apache::lonxml::pwd - path to the directory containing
+ the file currently being processed
-
- Apache::lonxml::outputstack -
+ @Apache::lonxml::outputstack
+ $Apache::lonxml::redirection - these two are used for
+ capturing a subset of the output for later processing, don't
+ touch them directly use &startredirection and &endredirection
-
- Apache::lonxml::redirection -
+ $Apache::lonxml::import - controls whether the
+ <import> tag actually does anything
-
- Apache::lonxml::import -
+ @Apache::lonxml::extlinks - a list of URLs that the
+ user is allowed to look at because of the current resource
+ (images, and links)
-
- Apache::lonxml::extlinks -
+ $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::metamode -
+ $Apache::lonxml::evaluate - controls whether
+ run::evaluate actually derefences variable references
-
- Apache::lonxml::evaluate -
+ %Apache::lonxml::insertlist - data structure for edit
+ mode, determines what tags can go into what other tags
-
- Apache::lonxml::insertlist -
+ @Apache::lonxml::namespace - stores the list of tag
+ namespaces used in the insertlist.tab file that are currently
+ active, used only in edit mode.
-
- Apache::lonxml::namespace -
+ $Apache::lonxml::registered - set to 1 once the remote
+ has been updated to know what resource we are looking at.
-
- Apache::lonxml:: -
+ $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
@@ -85,6 +152,23 @@
%Apache::lonxml::insertlist structure of what tags can have
what other tags inside.
+ -
+ whichuser - returns a list of $symb, $courseid,
+ $domain, $name that is correct for calls to lonnet functions
+ 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
@@ -117,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
+ 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
- Apaceh::scripttag::start_script for an example.)
+ 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
@@ -145,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
@@ -164,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
@@ -178,24 +303,29 @@ sub BEGIN {
Style File specific tags
-
- <definetag> -
+ <definetag> - 2 arguments, name name of
+ new tag being defined, if proceeded with a / defining an end
+ tag, required; parms parameters of the new tag, the
+ value of these parameters can be accesed by $parametername.
-
- <render> -
+ <render> - define what the new tag does for a non meta target
-
- <meta> -
+ <meta> - define what the new tag does for a meta target
-
- <tex> / <web> / <latexsource> -
+ <tex> / <web> / <latexsource> -
+ define what a new tag does for a specific no meta target, all
+ data inside a <render> is render to all targets except
+ when surrounded by a specific target tags.
-
Guy Albertelli
-Last modified: Sun May 20 23:34:57 EDT 2001
+Last modified: Mon Oct 21 16:41:56 EDT 2002