removing elements in namespace

Discussion in 'Javascript' started by Martin Honnen, Sep 12, 2004.

  1. 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>


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Sep 12, 2004
    #1
    1. Advertising

  2. 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/d.../author/dhtml/reference/properties/tagurn.asp
    http://msdn.microsoft.com/library/d...thor/dhtml/reference/properties/scopename.asp

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Sep 12, 2004
    #2
    1. Advertising

  3. Martin Honnen

    Graham Guest

    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
     
    Graham, Sep 12, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marco_segurini
    Replies:
    6
    Views:
    396
    Donovan Hawkins
    Nov 26, 2004
  2. Chris  Chiasson
    Replies:
    6
    Views:
    627
    Richard Tobin
    Nov 14, 2006
  3. Adam Hartshorne
    Replies:
    2
    Views:
    378
    Nitin Motgi
    Jan 27, 2006
  4. Andy Fish
    Replies:
    10
    Views:
    1,143
    Joseph Kesselman
    May 4, 2007
  5. K.I.

    removing namespace std

    K.I., Jul 16, 2008, in forum: C++
    Replies:
    3
    Views:
    312
Loading...

Share This Page