Problem:
You need to read in all the elements of an XML document and obtain information about each element, such as its name and attributes.
Solution:
Create an XmlReader and use its Read method to process the document as shown in Example 15-1...
Problem:
Given a URL that points to an XML document, you need to grab the XML.
Solution:
Use the XmlReader constructor that takes a URL as a parameter:
string url = "http://localhost/xml/sample.xml";
using (XmlReader reader = XmlReader.C...
Problem:
You have a large and complex XML document and you need to find various pieces of information, such as all the information contained within a specific element and having a particular attribute setting. You want to query the XML structure wit...
Problem:
You are accepting an XML document created by another source and you want to verify that it conforms to a specific schema. This schema may be in the form of an XML schema (XSD or XMLXDR); alternatively, you want the flexibility to use a docu...
Problem:
You have data that you want to put into a more structured form, such as an XML document.
Solution:
Suppose you have the information shown in Table 15-2 for an address book that you want to turn into XML.
Table 15-2. Sample address bo...
Problem:
You need to inform one or more classes or components that a node in an XML document has been inserted or removed or had its value changed.
Solution:
In order to track changes to an active XML document, subscribe to the events publishe...
Problem:
You are creating an XML string. Before adding a tag containing a text element, you want to check it to determine whether the string contains any of the following invalid characters:
<
>
"
'
&
If any of these chara...
Problem:
You have a raw XML document that you need to convert into a more readable format. For example, you have personnel data that is stored as an XML document and you need to display it on a web page or place it in a comma-delimited text file for...
Problem:
You have an XML document that needs to be broken apart into multiple parts. Each part can then be sent to a different destination (possibly a web service) to be processed individually. This solution is useful when you have a large document,...
Problem:
You have various pieces of a document in XML form that need to be put together to form a single XML documentthe opposite of what was done in Recipe 15.9. In this case, you have received various pieces of an invoice in XML form. For example,...
Problem:
You are using the XmlDocument to modify an XML document loaded in memory. Once the document has been modified, the modifications need to be verified and schema defaults need to be enforced.
Solution:
Use the XmlDocument.Validate metho...
Problem:
You want to perform operations that are outside the scope of XSLT to include data in the transformed result.
Solution:
Add an extension object to the transformation that can perform the operations necessary based on the node it is pas...
Problem:
You have come on to a new project in which XML was used for data transmission, but the programmers who came before you didn't use an XSD for one reason or another. You need to generate beginning schema files for each of the XML examples.
...
Problem:
You need to use XSLT to produce information that has a few data items that could change between transformations and you don't want to have a separate XSLT stylesheet for each variation.
Solution:
Use the XsltArgumentList class to pass...
AJAX popular information C# language guides Windows books and cookbooks
.......
С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.