Tôi có xml tiếp theo:Serialize xml yếu tố khác nhau đến một số tài sản trong C#
<table-display-fields>
<field name="NAME/>
<field name="DESCRIPTION" />
</table-display-fields>
tôi deserealize rằng với mã tiếp theo:
[XmlArray("table-display-fields")]
[XmlArrayItem("field")]
public TableDisplayField[] TableDisplayFields;
Sau đó, tôi thêm yếu tố xml mới cho bảng hiển thị-lĩnh vực nút:
<table-display-fields>
<record-number-field name="ID" />
<field name="NAME/>
<field name="DESCRIPTION" />
</table-display-fields>
Sau đó thêm mã tiếp theo để khử hồ sơ số trường:
[XmlArray("table-display-fields")]
[XmlArrayItem("record-number-field")]
public TableDisplayField[] RecordTableDisplayFields;
[XmlArray("table-display-fields")]
[XmlArrayItem("field")]
public TableDisplayField[] TableDisplayFields;
Điều này không hiệu quả. Làm cách nào để loại bỏ xml mới và lưu đường dẫn thuộc tính hiện tại?
Tính năng này không hoạt động? Chính xác thì điều gì xảy ra? –
Tôi có ngoại lệ tiếp theo: System.Web.HttpUnhandledException (0x80004005): Ngoại lệ loại 'System.Web.HttpUnhandledException' đã bị ném. ---> System.InvalidOperationException: Đã xảy ra lỗi khi phản ánh loại 'TableDisplayConfiguration'. ---> System.InvalidOperationException: Đã xảy ra lỗi khi phản ánh trường 'TableDisplayFields'. ---> System.InvalidOperationException: Thành phần XML 'table-display-fields' từ không gian tên 'http: // localhost/configuration/application' đã có mặt trong phạm vi hiện tại. Sử dụng các thuộc tính XML để chỉ định một tên hoặc không gian tên XML khác cho phần tử. – tbicr