急急急!XML解析问题!!!
目前有这样一段XML解析PHP代码:
PHP code:
<?php
$xml = simplexml_load_file("test.xml");
echo $xml->getName() . "<br />";
foreach($xml->children() as $child) {
echo $child->getName() . ": " . $child . "<br />";
}
?>
有下面的XML:
XML code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>
这样php能正确输出结果:
note
to: George
from: John
heading: Reminder
body: Don't forget the meeting!
但是若XML变成:
XML code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>
<name>
<Chinesename>Zhang</Chinesename>
<Englishname>Jonn</Englishname>
</name>
<age>21</age>
</from>
<heading>Reminder</heading>
<body>Don't forget the meeti
相关问答:
现在有个xml文件是<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xm ......
现在我写了存储过程,把表里面的数据导出到xml中,现在的格式是:
<?xml version="1.0" encoding="GBK" ?>
<PEOPLE>
<PERSON PERSONID="1">
&l ......
如何添加XML结点和相对应的值。请大家帮帮忙
---------------------------------------
Asp.Net,C#,SQL,JS,WCF,AJAX,工作流,WPF,MVC,LINQ,设计模式(架构)等技术讨论
“ASP.NET(C#)Fans” QQ群:96877690 ......
我要在网页上上传一个XML文件,我在C#中写了一个验证XML文件格式的方法:
private bool ValidateXml(string xmlFilePath)
{
string xsdPath = Request.PhysicalApp ......