【发布时间】:2010-08-24 08:32:52
【问题描述】:
我对解析 XML 文件比较陌生,我正在尝试使用 XMLReader 读取大型 XML 文件。
<?xml version="1.0" encoding="UTF-8"?>
<ShowVehicleRemarketing environment="Production" lang="en-CA" release="8.1-Lite" xsi:schemaLocation="http://www.starstandards.org/STAR /STAR/Rev4.2.4/BODs/Standalone/ShowVehicleRemarketing.xsd">
<ApplicationArea>
<Sender>
<Component>Component</Component>
<Task>Task</Task>
<ReferenceId>w5/cron</ReferenceId>
<CreatorNameCode>CreatorNameCode</CreatorNameCode>
<SenderNameCode>SenderNameCode</SenderNameCode>
<SenderURI>http://www.example.com</SenderURI>
<Language>en-CA</Language>
<ServiceId>ServiceId</ServiceId>
</Sender>
<CreationDateTime>CreationDateTime</CreationDateTime>
<Destination>
<DestinationNameCode>example</DestinationNameCode>
</Destination>
</ApplicationArea>
...
我收到以下错误
ErrorException [警告]: XMLReader::read() [xmlreader.read]: compress.zlib://D:/WebDev/example/local/public/../upload/example.xml.gz:2:命名空间错误:未定义 ShowVehicleRemarketing 上 schemaLocation 的命名空间前缀 xsi
我已经四处搜索,找不到太多有用的信息来使用 XMLReader 读取带有命名空间的 XML 文件——如果这实际上是我需要做的,我将如何定义命名空间.. 帮助不大?相关资源的链接?
【问题讨论】:
-
虽然我比上一个更喜欢这个问题的标题,但它仍然是重复的。对不起。
-
它甚至不是只是重复,它是同一个用户在两个小时内再次问同一个问题......
-
你duplicated your own question 2 hours later。请不要这样做,它对任何人都没有帮助,而且是糟糕的 SEO(注意:允许欺骗,但不要重复问同一个问题)。请参阅FAQ 了解如何使用本网站。
标签: php xml parsing xmlreader xml-namespaces