诚然,我在这里学习,并且在序列化和反序列化 xml 方面取得了进展。
我的问题是,如何访问URI
下面的 XML 中的?
<address href="/api/juniper/sd/address-management/addresses/98677"
uri="/api/juniper/sd/address-management/addresses/98677">
<name>Any-IPv4</name>
<address-type>ANY_IPV4</address-type>
<description>Predefined any-ipv4 address</description>
<host-name />
<id>98677</id>
</address>
真的不知道如何在我的课堂上设置它来反序列化它?
我的课现在看起来像:
[XmlRoot("address", Namespace = "")]
public class address
{
string _name;
string _editVersion;
string _addressType;
string _ipAddress;
string _description;
string _hostName;
string _zone;
string _addressVersion;
string _definitionType;
string _createdByUserName;
string _lastModifiedByUser;
string _createdTime;
string _lastModifiedTime;
string _id;
[XmlElement(ElementName = "name")]
public string name
{
get { return _name; }
set { _name = value; }
}
[XmlElement(ElementName = "edit-version")]
public string editversion
{
get { return _editVersion; }
set { _editVersion = value; }
}
[XmlElement(ElementName = "address-type")]
public string addresstype
{
get { return _addressType; }
set { _addressType = value; }
}
[XmlElement(ElementName = "ip-address")]
public string ipaddress
{
get { return _ipAddress; }
set { _ipAddress = value; }
}
[XmlElement(ElementName = "description")]
public string description
{
get { return _description; }
set { _description = value; }
}
[XmlElement(ElementName = "host-name")]
public string hostname
{
get { return _hostName; }
set { _hostName = value; }
}
}
提前致谢!