使用simplexml解析复杂xml
我使用simplexml从大型xml文件中提取信息,并将结果存储在mysql数据库中。这一切都很好,但是在这个xml中,如果日期不是属性或内部标记,那么如何确定日期呢使用simplexml解析复杂xml,xml,parsing,simplexml,Xml,Parsing,Simplexml,我使用simplexml从大型xml文件中提取信息,并将结果存储在mysql数据库中。这一切都很好,但是在这个xml中,如果日期不是属性或内部标记,那么如何确定日期呢 <operatingInformation> <normalOperation> <operatingDays> <days> <monday /> <tue
<operatingInformation>
<normalOperation>
<operatingDays>
<days>
<monday />
<tuesday />
</days>
</operatingDays>
</normalOperation>
</operatingInformation>
我需要的是提取日期的名称,以便将它们添加到我的数据库表中。将XML文档解析为$XML,这将循环显示日期并打印它们的名称:
foreach ( $xml->normalOperation->operatingDays->days->children() as $dayElem ) {
print $dayElem->getName() ."\n";
}