我的语言是asp.net。我使用 Linq 来解析 xml 文件。但是这个 xml 文件已经设置了命名空间。在加载 xml 文件之前。我尝试导入 xml 命名空间。但仍然无法正确解析 xml。
Imports <xmlns="abc">
<html>
<head>
<title>Do-Life</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../../img/css.css" rel="stylesheet" type="text/css">
<script runat="server">
Sub Page_Load(ByVal sender as Object, ByVal e as System.EventArgs)
If not isPostBack Then
....
Dim TYPINFO As XElement = XElement.Load(server.MapPath(filename))
Dim tinfos As IEnumerable(Of XElement)
tinfos = From tf In TYPINFO...<typhinfo> Select tf
....
....
xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<cwbtyphfcst xmlns="abc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cwb.wfc.typhoonfcstCE/namespace typhooninfor.xsd">
<announcement>
...