summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-08 00:25:35 (GMT)
committerDavid A. Madore <david+git@madore.org>2010-04-08 00:25:35 (GMT)
commitb67cab11ed1f8271a1157f6fc376d90de2b1cfb3 (patch)
tree51417fe43540ea0bb5a7baf213c5e7ad2275b867
parent24233a957fe518834b1c4299244706f4345ff993 (diff)
downloadblogengine-b67cab11ed1f8271a1157f6fc376d90de2b1cfb3.zip
blogengine-b67cab11ed1f8271a1157f6fc376d90de2b1cfb3.tar.gz
blogengine-b67cab11ed1f8271a1157f6fc376d90de2b1cfb3.tar.bz2
Make more sense of prefix handling (consider undef as empty string).
-rwxr-xr-xdaml2html.pl16
1 files changed, 8 insertions, 8 deletions
diff --git a/daml2html.pl b/daml2html.pl
index c1ca768..6de1b56 100755
--- a/daml2html.pl
+++ b/daml2html.pl
@@ -1045,26 +1045,26 @@ sub out_replicate_node {
my $type = $node->nodeType;
if ( $type == XML_ELEMENT_NODE ) {
my $ns_uri = $node->namespaceURI // XHTML_NS;
- my $ns_pfx = $node->prefix;
+ my $ns_pfx = $node->prefix // "";
my $ns_lname = $node->localName;
my $out_node = $out_doc->createElementNS(
$ns_uri, ($ns_pfx?"$ns_pfx:$ns_lname":$ns_lname));
$out_root = $out_node unless defined($out_root);
- if ( ! defined($out_namespaces{$ns_pfx//""}) ) {
- $out_root->setNamespace($ns_uri, $ns_pfx//"", $out_node==$out_root);
- $out_namespaces{$ns_pfx//""} = $ns_uri;
+ if ( ! defined($out_namespaces{$ns_pfx}) ) {
+ $out_root->setNamespace($ns_uri, $ns_pfx, $out_node==$out_root);
+ $out_namespaces{$ns_pfx} = $ns_uri;
# printf STDERR "added prefix %s => %s (for node %s)\n",
- # $ns_pfx//"(default)", $ns_uri, $ns_lname;
+ # $ns_pfx||"(default)", $ns_uri, $ns_lname;
}
foreach my $attr ( $node->attributes ) {
if ( $attr->nodeType == XML_ATTRIBUTE_NODE ) {
my $at_uri = $attr->namespaceURI;
- my $at_pfx = $attr->prefix;
+ my $at_pfx = $attr->prefix // "";
my $at_lname = $attr->localName;
if ( defined($at_uri)
- && ! defined($out_namespaces{$at_pfx//""}) ) {
+ && ! defined($out_namespaces{$at_pfx}) ) {
$out_root->setNamespace($at_uri, $at_pfx, 0);
- $out_namespaces{$at_pfx//""} = $at_uri;
+ $out_namespaces{$at_pfx} = $at_uri;
# printf STDERR "added prefix %s => %s (for attr %s)\n",
# $at_pfx//"(default)", $at_uri, $at_lname;
}