[Home] [By Thread] [By Date] [Recent Entries]

  • From: Sean Mc Grath <digitome@i...>
  • To: xml-dev@i...
  • Date: Wed, 31 Dec 1997 18:56:39 GMT

So this works if:

 1) No more than 1 telephone number per line [Chris]
 2) No cdata marked sections [Chris]
 3) The attribute value literal for client does not have any entity
references [Sean - suggested]
 4) The target telephone number does not contain entity references [Sean -
suggested ]
 5) appendix elements do not nest [Sean - suggested]
 6) Telephone numbers do not nest (problem if regexp matching is greedy)
[Sean - suggested]

Others? I think a little list of "gotchas" like this would find the way
onto many a DPH's wall (including mine!).

[Chris Maden]
>
>$inappendix = FALSE;
>
>while (<>) {
>    if (/<appendix/) {
>	$inappendix = TRUE;
>    }
>    if (/<\/appendix/) {
>	$inappendix = FALSE;
>    }
>    if ((/^(.*<telephone[^>]*>)555-1234(.*)$/) && $inappendix) {
>	$pre = $1;
>	$post = $2;
>	if (!(/client\s*=\s*["']Jones["']/)) {
>	    print $pre . "555-4321" . $post . "\n";
>	}
>	else {
>	    print $_;
>	}
>    }
>    else {
>	print $_;
>    }
>}
>
>
Sean Mc Grath
sean at digitome dot com




xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member