removing elements in namespace

M

Martin Honnen

Graham wrote:

Has anyone done this before? Is there some simple step I might
be missing? Given an element variable, could you give me a line
or two of code just to display the namespace tag?

With IE 5 and later on Win elements have two properties
scopeName
giving the prefix and
tagUrn
giving the Namespace URN for example

<html lang="en"
xmlns:gods="http://example.com/2004/09/gods">
<head>
<title>scopeName and tagUrn</title>
<script type="text/javascript">
function testNamespaceProperties () {
var elements = document.body.all;
if (elements) {
var result = '';
for (var i = 0; i < elements.length; i++) {
var element = elements;
result += 'tagName: ' + element.tagName + '; ';
result += 'scopeName: ' + element.scopeName + '; ';
result += 'tagUrn: ' + element.tagUrn;
result += '\r\n';
}
alert(result);
}
}

window.onload = function (evt) {
testNamespaceProperties();
};
</script>
</head>
<body>
<p id="p1">
This is a HTML paragraph.
</p>
<div>
<gods:GOD id="GOD">Kibo</gods:GOD>
</div>
</body>
</html>
 
G

Graham

Hi all,

I'm trying to clean up the output from Word that has been
pasted into a textarea. I'm purging much of the html (all
styles, attributes etc) and would also like to remove things
like vector graphics. To do this I want to simply drop all
elements (or their children) which are in any namespace other
than the default: all the microsoft-specific o:p, v:drawLine, etc
tags. But I can't persuade javascript to even see the namespaces!
I'm using IE5.5 (this needs to work on browsers that old, but no
older).

Has anyone done this before? Is there some simple step I might
be missing? Given an element variable, could you give me a line
or two of code just to display the namespace tag?

Thanks

Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top