GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  XML::QUOTE (3)

.ds Aq ’

NAME

XML::Quote - XML quote/dequote functions

CONTENTS

SYNOPSIS



  use strict;
  use XML::Quote qw(:all);
 
  my $str=q{666 > 444 & "apple" < earth};
  print xml_quote($str),"\n";
  # 666 > 444 & "apple" < 'earth'

  my $str2=q{666 > 444 & "apple" < 'earth'};
  print xml_dequote($str2),"\n";
  # 666 > 444 & "apple" < earth

  my $str3=q{666 > 444 & "apple" < earth};
  print xml_quote_min($str3),"\n";
  # 666 > 444 & "apple" < earth



DESCRIPTION

This module provides functions to quote/dequote strings in xml-way.

All functions are written in XS and are very fast; they correctly process utf8, tied, overloaded variables and all the rest of perl magic.

FUNCTIONS

$quoted = xml_quote($str); This function replaces all occurences of symbols ’&’, ’"’, ’’’, ’>’, ’<’ to ’&’, ’"’, ’'’, ’>’, ’<’ respectively.

Returns quoted string or undef if $str is undef.

$dequoted = xml_dequote($str); This function replaces all occurences of ’&’, ’"’, ’'’, ’>’, ’<’ to ’&’, ’"’, ’’’, ’>’, ’<’ respectively. All other entities (for example  ) will not be touched.

Returns dequoted string or undef if $str is undef.

$quoted = xml_quote_min($str); This function replaces all occurences of symbols ’&’, ’"’, ’<’ to ’&’, ’"’, ’<’ respectively. Symbols ’’’ and ’>’ are not replaced.

Returns quoted string or undef if $str is undef.

EXPORT

xml_quote(), xml_dequote() are exported as default.

PERFORMANCE

You can use t/benchmark.pl to test the perfomance. Here is the result on my P4 box.



  Benchmark: timing 1000000 iterations of perl quote, xs quote...
  perl quote: 108 wallclock secs (88.08 usr +  0.01 sys = 88.09 CPU) @ 11351.64/s (n=1000000)
    xs quote: 20 wallclock secs (16.78 usr +  0.00 sys = 16.78 CPU) @ 59591.20/s (n=1000000)

  Benchmark: timing 1000000 iterations of perl dequote, xs dequote...
  perl dequote: 106 wallclock secs (85.22 usr +  0.09 sys = 85.31 CPU) @ 11721.54/s (n=1000000)
    xs dequote: 19 wallclock secs (15.92 usr +  0.02 sys = 15.94 CPU) @ 62743.13/s (n=1000000)



AUTHOR

Sergey Skvortsov <skv@protey.ru>

SEE ALSO

<http://www.w3.org/TR/REC-xml>, perlre

COPYRIGHT

Copyright 2003 Sergey Skvortsov <skv@protey.ru>. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 QUOTE (3) 2003-01-31

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.