【发布时间】:2015-06-18 06:33:20
【问题描述】:
我在 .NET 中调用一个 Web 服务操作,它返回带有以下类对象的 xml 数据:
public partial class data : object, System.ComponentModel.INotifyPropertyChanged {
private object[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("currentRow", typeof(dataCurrentRow), Order=0)]
[System.Xml.Serialization.XmlElementAttribute("deleteRow", typeof(dataDeleteRow), Order=0)]
[System.Xml.Serialization.XmlElementAttribute("insertRow", typeof(dataInsertRow), Order=0)]
[System.Xml.Serialization.XmlElementAttribute("modifyRow", typeof(dataModifyRow), Order=0)]
public object[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
this.RaisePropertyChanged("Items");
}
}
public partial class dataCurrentRow : object, System.ComponentModel.INotifyPropertyChanged {
private object[] columnValueField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("columnValue", Order=0)]
public object[] columnValue {
get {
return this.columnValueField;
}
set {
this.columnValueField = value;
this.RaisePropertyChanged("columnValue");
}
}
从 Web 服务调用返回的 XML:
<QAS_GETQUERYRESULTS_RESP_MSG xmlns="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETQUERYRESULTS_RESP_MSG.VERSION_1">
<webRowSet xmlns="http://java.sun.com/xml/ns/jdbc">
<properties>
...
...
</properties>
<metadata>
...
...
</metadata>
<data>
<currentRow>
<columnValue>abc</columnValue>
<columnValue>123</columnValue>
<columnValue>xyz</columnValue>
</currentRow>
<currentRow>
<columnValue>def</columnValue>
<columnValue>456</columnValue>
<columnValue>opq</columnValue>
</currentRow>
</data>
</webRowSet>
</QAS_GETQUERYRESULTS_RESP_MSG>
但是,我不确定如何使用类对象“data”访问 .NET 中的 xml 值“columnValue”。请帮助向我展示如何访问这些值。非常感谢!
【问题讨论】:
标签: c# .net xml web-services xml-parsing