--- doc/homework/xml.html 2002/05/03 18:34:20 1.3 +++ 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
  • @@ -62,15 +63,71 @@ $Apache::lonxml::registered - set to 1 once the remote has been updated to know what resource we are looking at.
  • +
  • + $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

    Functions Tag Handlers can use

    @@ -133,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 @@ -161,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 @@ -180,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 @@ -216,7 +325,7 @@ sub BEGIN {
    Guy Albertelli
    -Last modified: Fri May 3 14:26:22 EDT 2002 +Last modified: Mon Oct 21 16:41:56 EDT 2002