【发布时间】:2011-04-19 13:42:00
【问题描述】:
我正在获取一个 XML 字符串并在 PHP 中对其进行编辑,以便在访问 PHP 文件时最终输出编辑后的 XML 字符串。我一直在尝试使用 echo 和 print 来输出 XML 文档,但它只打印最里面的标签内的数据。我希望它能够像您直接加载 XML 文档(例如 test.com/example.xml)一样运行。相反,它只打印出字符串的一部分而不是整个字符串。打印语句如下。有什么建议吗?
打印
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<Style id="undecorated_style">
<BalloonStyle>
<displayMode>undecorated</displayMode>
</BalloonStyle>
</Style>
<Placemark>
<name>Relative Marker Example</name>
<description><![CDATA[
<div style="position: absolute; width: 100px; height: 100px; left: -50px; top: -50px"><img width="100px" height="100px" src="http://argonapps.gatech.edu/examples/FrameMarkerThin_005.png"/></div>
]]>
</description>
<balloonVisibility>1</balloonVisibility>
<Marker>
<markerType>framesimpleid</markerType>
<markerId>-1</markerId> <!-- integer value (-1 means follow any marker of markerType) -->
<locationMode>relative</locationMode> <!-- default (ignore), relative (update location), fixed (update camera) -->
<orientationMode>fixed</orientationMode>
<scale>
<x>0.076</x> <!-- test marker is 0.038 meters -->
<y>0.076</y>
<z>0.076</z>
</scale>
</Marker>
<styleUrl>#undecorated_style</styleUrl>
</Placemark>
';
在浏览器中打开文件只显示:
相对标记示例 ]]> 1 帧simpleid -1 相对固定 0.076 0.076 0.076 #undecorated_style
而不是简单的 xml。
【问题讨论】: