TAILIEUCHUNG - C# 3.0 Cookbook phần 8

Một mục để được nhận thức khi giao dịch với XmlDocuments nhiều là khi bạn có một nút từ một XmlDocument, bạn có thể không chỉ cần nối thêm nó như là một đứa trẻ đến một nút trong một XmlDocument khác nhau bởi vì nút có bối cảnh của XmlDocument gốc. Nếu bạn cố gắng để làm điều này, bạn sẽ nhận được thông báo ngoại lệ sau đây: | One item to be aware of when dealing with multiple XmlDocuments is that when you take a node from one XmlDocument you cannot just append it as a child to a node in a different XmlDocument because the node has the context of the original XmlDocument. If you try to do this you will get the following exception message The node to be inserted is from a different document context. To fix this use the method which will make a copy deep when the second parameter is true or shallow when the second parameter is false of the node you are bringing over to the new XmlDocument. For instance when you add the shipping information like so shipInfo true this line takes the shipInfo node clones it deeply dien appends it to the main invoice node. See Also The XElement Class The Three Parts of a LINQ Query XmlDocument Class XmlElement Class and XmlAttribute Class topics in the MSDN documentation. Validating Modified XML Documents Without Reloading Problem You are using the XDocument or the XmlDocument to modify an XML document loaded in memory. Once the document has been modihed the modifications eedd to Pc eer-ified and schema defaults need to be enforced. Solution Use the method to perform the validation and apply schema defaults and type information. Create an XmlSchemaSet with the XML Schema document and an XmlReader and then load the file Create the schema set XmlSchemaSet xmlSchemaSet new XmlSchemaSet add the new schema with the target namespace could add all the schema at once here if there are multiple http @ . . XDocument book @ . . Validating Modified XML Documents Without Reloading 591 Set up a ValidationEventHandler to catch any errors and then call XDocument. Validate with the schema set and the event handler to validate against the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.