Hi,

I am posting this to the Web list and XML list as I think this issue crosses
the boundary of both.

I have started to poke around with XML/XSL and noticed something strange. I
am using CGI to dynamically generate XML from a database. I have a
stylesheet to to transform this XML, render it and create a HTML FORM that
accepts inputs. These input parameters then get passed to the original CGI
script, the information gets added to the database and the XML is generated
again. (Essentially I am adding a child element.)

What I have found is the last (in the form) parameter value has an invisible
character in it.

For instance: My form has this
<FORM METHOD="POST">
<INPUT TYPE="TEXT" NAME="form_input_1">
<INPUT TYPE="TEXT" NAME="form_input_2">
<INPUT TYPE="TEXT" NAME="form_input_3">
<INPUT TYPE="TEXT" NAME="form_input_4">
<INPUT TYPE="TEXT" NAME="form_input_5">
<INPUT TYPE="SUBMIT">
</FORM>

I grab the passed parameters
$query->param("form_input_1");
$query->param("form_input_2");
$query->param("form_input_3");
$query->param("form_input_4");
$query->param("form_input_5");
These are then passed into the database.

When I then grab the database entries and output them to XML
<foo>
 <foo1>$form_input_1</foo1>
 <foo2>$form_input_2</foo2>
 <foo3>$form_input_3</foo3>
 <foo4>$form_input_4</foo4>
 <foo5>$form_input_5</foo5>
</foo>

However IE reports "An invalid character was found in text content. Line 1,
Position ..."
<foo><foo1>$form_input_1</foo1><foo2>$form_input_2</foo2><foo3>$form_input_3
</foo3><foo4>$form_input_4</foo4><foo5>$form_input_5

Now if I chop($form_input_5) before adding to the database or after I have
retrieved it from the it works fine because it removes the character
(whatever it is). Problem with this is it that it assumes that form_input_5
is always going to be the last parameter in the form which is not always the
case. For instance if the form has the 4 and 5 inputs reversed then the
character exists at the end of '<foo4>$form_input_4'.

I am assuming that this is not a problem generally as HTML is fault
tolerant, whereas XML is not.

Now I know there are a couple of work arounds to this, like passing another
blank parameter at the end of my form. Or 'chop'ping the last parameter
passed. However, I would rather not do that, as I do not really want to keep
track of the order I am passing parameters.

Is there away of choping the character off of the parameter string before
collecting the parameter values?

Is this a bug?

Thanks
Shawn


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to