diff options
author | David A. Madore <david+git@madore.org> | 2010-04-18 22:46:21 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2010-04-18 22:46:21 +0200 |
commit | b3177265e0da7d02b99b98d6d70bcb1cda9ff2cd (patch) | |
tree | 0b80537ea8c0137d8385c08c56b0e0c34731c385 /org/madore/damlengine/TodoDamlElement.java | |
parent | 9d602700ed1eae5ce4b443f5182e1a15e4875da2 (diff) | |
download | damlengine-b3177265e0da7d02b99b98d6d70bcb1cda9ff2cd.tar.gz damlengine-b3177265e0da7d02b99b98d6d70bcb1cda9ff2cd.tar.bz2 damlengine-b3177265e0da7d02b99b98d6d70bcb1cda9ff2cd.zip |
Fix misuse of getAttributeNS(), and handling of xml:lang.
Note to self: getAttributeNS() returns "", not null, when the
attribute is nonexistent.
Also, the XML spec (now) clearly states that "" is used for an
unknown/undefined language.
Diffstat (limited to 'org/madore/damlengine/TodoDamlElement.java')
-rw-r--r-- | org/madore/damlengine/TodoDamlElement.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java index 330c92d..e7b9527 100644 --- a/org/madore/damlengine/TodoDamlElement.java +++ b/org/madore/damlengine/TodoDamlElement.java @@ -26,12 +26,12 @@ public class TodoDamlElement extends TodoDefaultElement { public void handleNodeOnly() { if ( ! ( options instanceof DamlEngine.RootOptions ) ) throw new Error("daml node can only be root node"); - String uriToTop = node.getAttributeNS(null, "uri-to-top"); - if ( uriToTop != null ) - ctx.uriToTop = uriToTop; - String fileName = node.getAttributeNS(null, "file.name"); - if ( fileName != null ) - ctx.fileName = fileName; + final String uriToTopName = "uri-to-top"; + if ( node.hasAttributeNS(null, uriToTopName) ) + ctx.uriToTop = node.getAttributeNS(null, uriToTopName); + final String fileNameName = "file.name"; + if ( node.hasAttributeNS(null, fileNameName) ) + ctx.fileName = node.getAttributeNS(null, fileNameName); if ( ctx.htmlNode != null ) throw new Error("html node already defined at daml node"); @@ -68,7 +68,7 @@ public class TodoDamlElement extends TodoDefaultElement { } meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "link"); meta.setAttributeNS(null, "rel", "Shortcut Icon"); - meta.setAttributeNS(null, "href", (((uriToTop!=null)?uriToTop:"") + meta.setAttributeNS(null, "href", (((ctx.uriToTop!=null)?ctx.uriToTop:"") +"favicon.ico")); ctx.headNode.appendChild(meta); ctx.headNode.appendChild(ctx.doc.createTextNode("\n")); |