loadXML() and namespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It seems that if I use loadXML($string) and the $string has a namespace defined in it, domdocument is nuking the namespace and changing the nodenames from whatever to defaultwhatever.

Example -

<math xmlns="http://www.w3.org/1998/Math/MathML";>
  <mrow>
    <mrow>
      <msup>
        <mi>x</mi>
        <mn>2</mn>
      </msup>
      <mo>+</mo>
      <mrow>
        <mn>4</mn>
        <mo></mo>
        <mi>x</mi>
      </mrow>
      <mo>+</mo>
      <mn>4</mn>
    </mrow>
    <mo>=</mo>
    <mn>0</mn>
  </mrow>
</math>

would get changed to

<defaultmath>
  <defaultmrow>
    <defaultmrow>
      <defaultmsup>
        <defaultmi>x</defaultmi>
        <defaultmn>2</defaultmn>
      </defaultmsup>
      <defaultmo>+</defaultmo>
      <defaultmrow>
        <defaultmn>4</defaultmn>
        <defaultmo></defaultmo>
        <defaultmi>x</defaultmi>
      </defaultmrow>
      <defaultmo>+</defaultmo>
      <defaultmn>4</defaultmn>
    </defaultmrow>
    <defaultmo>=</defaultmo>
    <defaultmn>0</defaultmn>
  </defaultmrow>
</defaultmath>

which of course breaks the page.
So it seems I need to somehow tell loadXML() about the namespace so it doesn't do that, but I'm not having much luck with the php manual, DOMDocument documentation seems a little on the "not written" side.

When I create the nodes and add them to the dom via domdocument it works fine, but the issue is I like to cache the content div as a string and load it when the page is requested (stuff outside the content div needs to be dynamic and not cached) but this namespace issue prevents that.

Any tips would be appreciated, caching makes a huge difference.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux