RE: Bug in Apache::ASP XMLSubs when an argument includes ''-characte rs?

2000-08-28 Thread Henrik Tougaard

Joshua Chamas wrote:
 
 I think  is just about the only thing that you can't use as
 a character in the attributes for an XMLSubs and that's because
 it gets parsed with an aggressive ( or stupid ;) regexp like:
 
   $$data =~ s|\\s*($self-{xml_subs_match})([^\]*)/\


Pity!
I would like to use XMLSubs to capture some HTML-output and do
postprocess them accoring to the attributes.

Eg. if $Response-{UserName} is "Joshua" then bold part of the page.
It could be done something like this:

My:tag_it condition="$Response-{UserName} eq 'Joshua'"
start_tag='b' end_tag='/b'
  ..some HTML here...
/My:tag_it [Stupid example, but I hope you get the idea]

OK the tags are out. I can handle that by making an XMLSub
for every tag-pair that I need, or whatever...
But it is a pian to have to say:

% $svtwnbu=$Response-{UserName} eq 'Joshua', %
My:bold_it condition=$sbtwnbu
   ...more HTML here...
/My:bold_it

[Where $svtwnbu is some-variable-that-will-never-be-used elsewhere :-]

Not so neat.

Is there a simpler way of doing this?

---
Henrik Tougaard, FOA, Denmark.



RE: Bug in Apache::ASP XMLSubs when an argument includes ''-characte rs?

2000-08-28 Thread Bryan McGuire

What 'bout $sv=$$hashref{key} instead of $sv=$hashref-{key}? It's one
less character of typing so it's easier on your fingers too!

-Original Message-
From: Henrik Tougaard [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 28, 2000 4:59 AM
To: '[EMAIL PROTECTED]'
Cc: 'Joshua Chamas'
Subject: RE: Bug in Apache::ASP XMLSubs when an argument includes
''-characte rs?


Joshua Chamas wrote:

 I think  is just about the only thing that you can't use as
 a character in the attributes for an XMLSubs and that's because
 it gets parsed with an aggressive ( or stupid ;) regexp like:

   $$data =~ s|\\s*($self-{xml_subs_match})([^\]*)/\


Pity!
I would like to use XMLSubs to capture some HTML-output and do
postprocess them accoring to the attributes.

Eg. if $Response-{UserName} is "Joshua" then bold part of the page.
It could be done something like this:

My:tag_it condition="$Response-{UserName} eq 'Joshua'"
start_tag='b' end_tag='/b'
  ..some HTML here...
/My:tag_it [Stupid example, but I hope you get the idea]

OK the tags are out. I can handle that by making an XMLSub
for every tag-pair that I need, or whatever...
But it is a pian to have to say:

% $svtwnbu=$Response-{UserName} eq 'Joshua', %
My:bold_it condition=$sbtwnbu
   ...more HTML here...
/My:bold_it

[Where $svtwnbu is some-variable-that-will-never-be-used elsewhere :-]

Not so neat.

Is there a simpler way of doing this?

---
Henrik Tougaard, FOA, Denmark.




Re: Bug in Apache::ASP XMLSubs when an argument includes ''-characte rs?

2000-08-24 Thread Joshua Chamas

Henrik Tougaard wrote:
 
  XML attributes can't contain "" or "" characters, or the
  same quote that
  they are surrounded by. The following are the encodings you can use
  (and XMLSubsMatch needs to unravel):
 
 =  "lt;"
 =  "gt;"
 =  "amp;"
  "   =  "quot;"
  '   =  "apos;"
 
  Note that only "" is needed for your example (since encoding the
  "" isn't mandatory in XML generally).
 
 Well this does limit the usefullness of the XMLSubs feature.
 I had hoped that it would be possbile to use any perl expression in
 the attributes - as an easy way of giving arguments to the perl-sub.
 

I think  is just about the only thing that you can't use as
a character in the attributes for an XMLSubs and that's because
it gets parsed with an aggressive ( or stupid ;) regexp like:

$$data =~ s|\\s*($self-{xml_subs_match})([^\]*)/\

So basically what its doing is looking for everything up
to the first  so to put that in the data pretty well kills
it.  The arguments are further evaluated from there as $2.
Its simple and fast, and would be really good to keep it 
this way.  

Note that XMLSubs attributes can be most valid perl expressions,
but I don't think  could be supported in this context either.

Another related XMLSubs attribute issue came up recently
where it was hard to quote the @ character because in perl
"some@email" will error usually, and the quick fix for this
is to have an argument with single quotes like email='some@email'

Internally an XMLSubs attribute will go from 
  my:tag email='some@email' range=10 /
to something like
  my::tag(email = 'some@email', range = 10)

-- Joshua

_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks  free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



RE: Bug in Apache::ASP XMLSubs when an argument includes ''-characte rs?

2000-08-15 Thread Henrik Tougaard

 From: Matt Sergeant [mailto:[EMAIL PROTECTED]]
 On Fri, 11 Aug 2000, Henrik Tougaard wrote:
  With this simple .asp page I get an error:
  
  Fiks:test Start="b" /Fiks:test
  [My XMLSubMatch is set to Fiks:\w+  - the name of the 
 subroutine doesn't
  matter]
  
  It seems as if the '' in the 'b' argument confuses the parser.
 
 [snip]
 
  Is this a (mis)feature or a parser bug?
 
 parser bug - it should have died earlier at the  sign :-)
 
 XML attributes can't contain "" or "" characters, or the 
 same quote that
 they are surrounded by. The following are the encodings you can use
 (and XMLSubsMatch needs to unravel):
 
=  "lt;"
=  "gt;"
=  "amp;"
 "   =  "quot;"
 '   =  "apos;"
 
 Note that only "" is needed for your example (since encoding the
 "" isn't mandatory in XML generally).
 
Well this does limit the usefullness of the XMLSubs feature.
I had hoped that it would be possbile to use any perl expression in
the attributes - as an easy way of giving arguments to the perl-sub.

Pity

--
Henrik



RE: Bug in Apache::ASP XMLSubs when an argument includes ''-characte rs?

2000-08-15 Thread Matt Sergeant

On Tue, 15 Aug 2000, Henrik Tougaard wrote:

  XML attributes can't contain "" or "" characters, or the 
  same quote that
  they are surrounded by. The following are the encodings you can use
  (and XMLSubsMatch needs to unravel):
  
 =  "lt;"
 =  "gt;"
 =  "amp;"
  "   =  "quot;"
  '   =  "apos;"
  
  Note that only "" is needed for your example (since encoding the
  "" isn't mandatory in XML generally).
  
 Well this does limit the usefullness of the XMLSubs feature.
 I had hoped that it would be possbile to use any perl expression in
 the attributes - as an easy way of giving arguments to the perl-sub.

Note that I'm speaking not from Apache::ASP's point of view, but from an
XML point of view. I don't know if Joshua wants to work around these rules
- I certainly never saw a necessity of encoding "" in an attribute
value. Its not like its really difficult to parse without it. In fact its
_more_ overhead to do it the way the XML spec specifies...

-- 
Matt/

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org