XML

From wiki
Revision as of 12:51, 19 March 2018 by Hdridder (talk | contribs) (Created page with "Generic remarks about XML. Comments start with '<!--' and end with '-->'. Comments cannot be nested. Regular expressions to remove comments (Perl code) <syntaxhighlight lang...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Generic remarks about XML.

Comments start with . Comments cannot be nested.

Regular expressions to remove comments (Perl code)

#If comment-end is found remove comment-part.
#  comment-start may be on the same line.
if ( $line =~ /(\<\!--)?.*--\>/ ) {
 $comment = 0;
 $line =~ s/$&//;
# If there is only a comment-start, clear line until comment-end is found
} elsif ( $line =~ /\<\!--/ ) {
 $comment = 1;
 $line =~ s/\<\!--.*$//;
}
if ( $comment ) {
  $line = '';
}