By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

removing elements in namespace

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


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[i];
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>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a


Martin Honnen wrote:


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


Documentation is here
http://msdn.microsoft.com/library/de...ies/tagurn.asp
http://msdn.microsoft.com/library/de.../scopename.asp

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.