Как удалить родительский узел XML в ASP.NET с помощью C#?
Я хочу удалить родительский узел xml в asp.net с помощью c#. Я хочу удалить узел запроса xml, упомянутый ниже с точки зрения кода.
<pre><?xml version="1.0" encoding="utf-16"?> <Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <webServiceRequest> <entityDetails> <entityId>123</entityId> <userName>TEST</userName> <password>TEST123</password> <serviceId>12344321</serviceId> <requesterWsiRef>WSI246744113661143180</requesterWsiRef> </entityDetails> <requestDetails> <encrypyedRequestKeyData>fye1gPxpyejR35ziHJyAAQ==</encrypyedRequestKeyData> <encryptedRequestData>o9mKUt4fdQHFoAMKMP+4UB8PCJItb5JZS9FszbvbM3Wg5fc8UWdGQxOCMNVieQjNgOtNebTY5xLnH41jOErJ/F5W2rY/KZrstrZZ76ifpjjtcCj/sgkcs3RoL5CnoBEpNaqWdr1c6/WXf2mKG9qSpcFy8nJACS0pDBCUFSFfXBICiLJZBM6puSl5LYcGcBq9N9tvtQrcHtK5OhxKSh4tw8/dYY7/iF4rJYR1feBLFSko0jrCBilGR4hq8JHLqDt0ei7hzdbUF5VoXYyy1W4eedias/vZlQbVFO7ut/M83NaghO/rxcd1c06KjQAHUa8L2Ue85zNUaaSMCGB2GOEpcoPtz2+8l92sR4lFVPTfLO1lTlrdaLPrN2ZGVg5P8z1U+2aRbxHgCJVNYwDTwEdHA8M5YlzWEpGeWC5RzkfhT3Df9OZLYdCImY+bSm+S4PIYr7yJGUXw2rA8581d6SeTvUvjhfBDxQ7srNK1lv0ucKzi7SmlzPF+Dj8HvugloZkgYwQZuoH4RyF9DpEDMnFGZMc9Ic4Fhjw26DDi13DIxK0pPIGv3Z6t/z6K82yIvI6rrLtLcEwhbbYr4tD6t8PaAvOXHIxYQXthTFEt3TsJQ/Cof5DSopzS0m7tyP9bStoF8WstwHuq7Rpdxe58oOc0AoB0QmZI/+Y1Pe4qAs6iD8IstJw/7oBnB2xvfp2x/zpiMrh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I5it2xEMYqjQJ1mGZ6NlKnePwxpwM0MF50gvksc8kQNwLAWOepvFGmEc/M9WCBa2dk1sM55QQ1mKO4HmMCA/e+KkofdQptgGbjK85WF57MgaEHWnSILs8wIZ1TzlfNsuffux7CE9rBjTxxDkYNgpENJxqSuU+FXyxfVaq/Gi3RPF5gYGfJ6jnwJgSHMQbMZMIuqQ4Q7TDPPU2i/Wn93+BiuUlx3k1dezQ4qhGOke+OPbXmkikBoOnyOK0vpx97+me9gJFXFgKp4ZplndYZb/fFV3urhJGvqpJPu4kaMWYKcdgTnsSxyGW2p3PZ3fNejpmwyx4ShPK35xYBxjiKh4iYeEmiONqHbOid5/GEYwVdMcoIhaM9/U1RYk4azapTtvbPFKsn3Zf+Kl6pRnkFLEtSxclsfpm41dzJ24oRQvOedEgLAetzcG74fEjY1F8qfysRUszTvvsA9EWlZtWz3hnHPrFVHb3ZWKTw8h7av/c/YnQJHOuJfB55H09rTt19eN4WbofhpkwO3yTAqjsSXrnZnG825gR/ToyHtoQGKgJ1nCajDDX7abhoRDwXR7h08v5nglo8CFkFYvHnwzS2+Oj1Hq6SuuQJds33mRlHCLBS0BIGHxXCX37Gu2hGG1RXHJcZLdVzG6kv9m+E0q5v4jbteMYUKnce3UFZ39yJQ0uk+utKWYh3eLLfPVuYkRYluyNRK6o+8F3V92ir7+fR9didcKVmBYHwlgwMMYoVSU9Jhqk+OddZpNZdSW2QgR9OOvJh04v+f4V0aa5eQ0k+TD2Pqh4aMVJtTTk99ZfYeypv0Ph/1ZSn+2nhQphVmxD7FL5OrFOeMSwLDQxewLvGIVIqkqM5nckDlRe1PBJWp8Zj3WDUf93Woo7rDqw9BBN/f8wTz2DUqDNE6eWVjftgcR36KnfwOcw==</encryptedRequestData> </requestDetails> </webServiceRequest> </Request>
Узел для удаления вышеперечисленного xml
<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Что я уже пробовал:
Xml выглядит следующим образом:
<?xml version="1.0" encoding="utf-16"?> <Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <webServiceRequest> <entityDetails> <entityId>123</entityId> <userName>TEST</userName> <password>TEST123</password> <serviceId>12344321</serviceId> <requesterWsiRef>WSI246744113661143180</requesterWsiRef> </entityDetails> <requestDetails> <encrypyedRequestKeyData>fye1gPxpyejR35ziHJyAAQ==</encrypyedRequestKeyData> <encryptedRequestData>o9mKUt4fdQHFoAMKMP+4UB8PCJItb5JZS9FszbvbM3Wg5fc8UWdGQxOCMNVieQjNgOtNebTY5xLnH41jOErJ/F5W2rY/KZrstrZZ76ifpjjtcCj/sgkcs3RoL5CnoBEpNaqWdr1c6/WXf2mKG9qSpcFy8nJACS0pDBCUFSFfXBICiLJZBM6puSl5LYcGcBq9N9tvtQrcHtK5OhxKSh4tw8/dYY7/iF4rJYR1feBLFSko0jrCBilGR4hq8JHLqDt0ei7hzdbUF5VoXYyy1W4eedias/vZlQbVFO7ut/M83NaghO/rxcd1c06KjQAHUa8L2Ue85zNUaaSMCGB2GOEpcoPtz2+8l92sR4lFVPTfLO1lTlrdaLPrN2ZGVg5P8z1U+2aRbxHgCJVNYwDTwEdHA8M5YlzWEpGeWC5RzkfhT3Df9OZLYdCImY+bSm+S4PIYr7yJGUXw2rA8581d6SeTvUvjhfBDxQ7srNK1lv0ucKzi7SmlzPF+Dj8HvugloZkgYwQZuoH4RyF9DpEDMnFGZMc9Ic4Fhjw26DDi13DIxK0pPIGv3Z6t/z6K82yIvI6rrLtLcEwhbbYr4tD6t8PaAvOXHIxYQXthTFEt3TsJQ/Cof5DSopzS0m7tyP9bStoF8WstwHuq7Rpdxe58oOc0AoB0QmZI/+Y1Pe4qAs6iD8IstJw/7oBnB2xvfp2x/zpiMrhTYUxluz6JgvWrEoo80eRosFPLXNvq1VS+cZo5fS2aGdIoX+tPucSAzRG56jW5CBpuX0GRwmTAzBXjuuzN1CUY+I+b7dvKgAyK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jK85WF57MgaEHWnSILs8wIZ1TzlfNsuffux7CE9rBjTxxDkYNgpENJxqSuU+FXyxfVaq/Gi3RPF5gYGfJ6jnwJgSHMQbMZMIuqQ4Q7TDPPU2i/Wn93+BiuUlx3k1dezQ4qhGOke+OPbXmkikBoOnyOK0vpx97+me9gJFXFgKp4ZplndYZb/fFV3urhJGvqpJPu4kaMWYKcdgTnsSxyGW2p3PZ3fNejpmwyx4ShPK35xYBxjiKh4iYeEmiONqHbOid5/GEYwVdMcoIhaM9/U1RYk4azapTtvbPFKsn3Zf+Kl6pRnkFLEtSxclsfpm41dzJ24oRQvOedEgLAetzcG74fEjY1F8qfysRUszTvvsA9EWlZtWz3hnHPrFVHb3ZWKTw8h7av/c/YnQJHOuJfB55H09rTt19eN4WbofhpkwO3yTAqjsSXrnZnG825gR/ToyHtoQGKgJ1nCajDDX7abhoRDwXR7h08v5nglo8CFkFYvHnwzS2+Oj1Hq6SuuQJds33mRlHCLBS0BIGHxXCX37Gu2hGG1RXHJcZLdVzG6kv9m+E0q5v4jbteMYUKnce3UFZ39yJQ0uk+utKWYh3eLLfPVuYkRYluyNRK6o+8F3V92ir7+fR9didcKVmBYHwlgwMMYoVSU9Jhqk+OddZpNZdSW2QgR9OOvJh04v+f4V0aa5eQ0k+TD2Pqh4aMVJtTTk99ZfYeypv0Ph/1ZSn+2nhQphVmxD7FL5OrFOeMSwLDQxewLvGIVIqkqM5nckDlRe1PBJWp8Zj3WDUf93Woo7rDqw9BBN/f8wTz2DUqDNE6eWVjftgcR36KnfwOcw==</encryptedRequestData> </requestDetails> </webServiceRequest> </Request>
[no name]
Вы можете просто прочитать XmlElement webServiceRequest из этого XML-объекта и делать с ним все, что захотите....