Autor Zpráva
Sacrebleu
Profil *
Ahoj, mám problém - mám takovýhle kód:
$xmlstr1 = <<<XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title></dc:title><dc:subject></dc:subject><dc:creator></dc:creator><cp:keywords></cp:keywords><dc:description></dc:description><cp:lastModifiedBy></cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type="dcterms:W3CDTF">2011-02-26T18:23:00Z</dcterms:created><dcterms:modified xsi:type="dcterms:W3CDTF">2011-02-26T18:52:00Z</dcterms:modified></cp:coreProperties>
XML;

$xml1 = new SimpleXMLElement($xmlstr1);
var_dump($xml1);


var_dump() ale nevrací nic, co dělám špatně? Rád bych změnil položku <dc:creator></dc:creator> Předem díky za rady
DoubleThink
Profil *
Nevidím problém, zkontroluj error reporting (nebo log) a případně verzi (nebo podporu vůbec) extenze SimpleXML.
Sacrebleu
Profil *
Pokud je XML jiné - například tohle tak to funguje ale s výše uvedeným ne...
$xmlstr1 = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
 <movie>
  <title>PHP: Behind the Parser</title>
  <characters>
   <character>
    <name>Ms. Coder</name>
    <actor>Onlivia Actora</actor>
   </character>
   <character>
    <name>Mr. Coder</name>
    <actor>El ActÓr</actor>
   </character>
  </characters>
  <plot>
   So, this language. It's like, a programming language. Or is it a
   scripting language? All is revealed in this thrilling horror spoof
   of a documentary.
  </plot>
  <great-lines>
   <line>PHP solves all my web problems</line>
  </great-lines>
  <rating type="thumbs">7</rating>
  <rating type="stars">5</rating>
 </movie>
</movies>
XML;
Sacrebleu
Profil *
Asi to bude tímhle: SimpleXML does not correctly parse SOAP XML results if the result comes back with colons ‘:’ in a tag, like <soap:Envelope>. Why? Because SimpleXML treats the colon character ‘:’ as an XML namespace, and places the entire contents of the SOAP XML result inside a namespace within the SimpleXML object. There is no real way to correct this using SimpleXML, but we can alter the raw XML result a little before we send it to SimpleXML to parse.

Ale jak to teda udělat?

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: