SAX-J and the DPH (DJH?)

Sean Mc Grath digitome at iol.ie
Wed Dec 31 18:56:48 GMT 1997


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 at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list