I'm pretty sure this is not possible, but I thought I'd ask the experts to make sure.

I'm working with a large, very deep set of XML data, and mostly my perl script needs to read in the XML - parse the data, do a few modifications/alterations/aggregations, then dump to a DB.

The source XML has a xmls tag defined in the root, which is completely irrelevant to what I am doing with it. As we all know, LibXML becomes a serious pain to work with when namespaces are defined like this, and since I am traveling to 8 or 9 levels of child nodes multiple times, and doing operations on each, I fear for my sanity having to redefine and declare the XPathContext.

So my question is simple, is there any way (barring a sed on the source to remove it before parsing..) to remove namespace from the LibXML parsed object? There seem to be plenty of ways to define new ones, and I haven't seen a definitive answer yet anywhere on this one.

Your thoughts are appreciated.


In reply to LibXML - Removing Namespace? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.