In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Net Framework how to deal with XML operation skills, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The .NET Framework has a wide range of applications. Many developers will use it to create an environment suitable for development to help us improve development efficiency. Before the advent of .NET Framework, I was used to using MSXML services, a COM-based class library, and a driver for writing XML for Windows. Unlike the classes in the .NET Framework, some of the code in the MSXML class library is deeper than API, which is completely embedded at the bottom of the operating system.
It is true that MSXML can communicate with your application, but it does not really integrate with the external environment. The MSXML class library can be imported in win32 or used in CLR, but it can only be used as an external server component. But applications based on the .NET Framework can directly integrate other namespaces that the .NET Framework processes the XML, and the written code is easy to read.
As a stand-alone component, the MSXML parser provides some advanced features such as asynchronous analysis. This feature is not available in the XML class in .NET Framework and other classes in .NET Framework, but the XML class in .NET Framework can easily get the same functionality when integrated with other classes, and you can add more functionality on this basis.
The .NET Framework classes that deal with XML provide basic functions for analyzing, querying, and transforming XML data. In the .NET Framework, you can find classes that support Xpath queries and XSLT transformations, as well as classes that read / write XML documents. In addition,. NET Framework also contains other classes that handle XML, such as object serialization (XmlSerializer and the SoapFormatter classes), application configuration (AppSettingsReader classes), and data stores (DataSet classes).
Since XML is a markup language, there should be a tool to parse and understand the information stored in the document according to a certain syntax. This tool is the XML parser-a component that reads tagged text and returns objects for a specified platform.
The main function of the analyzer is to check whether the XML file has structural errors, peel off the tags in the XML file, read out the correct content, and hand it over to the next application for processing. XML is a markup language used to structure file information. In the XML specification, there are detailed rules on how to mark the structure of files. Parsers are software written according to these rules (mostly written in Java). Like HTML, browsers must have HTML parsers so that browsers can "read" web pages made up of HTML tags and display them in front of us. If there are tags that the browser's HTML parser cannot read, it will return an error message to us.
All XML parsers, no matter which operating platform they belong to, fall into two categories: tree-based or event-based handlers. These two types are usually implemented in XMLDOM (the Microsoft XML Document Object Model) and SAX (Simple API for XML). The XMLDOM parser is a normal tree-based API that renders an XML document as a memory structure tree. The SAX parser is an event-based API that processes each element in the XML data stream (it puts the XML data into the stream and then processes it). Typically, DOM can be loaded and executed by a SAX stream, so the two types of processing are not mutually exclusive.
In general, SAX parsers are the opposite of XMLDOM parsers, and their analysis patterns are very different. XMLDOM is well defined in its functionalition collection, and you can't extend it. When it is dealing with a large document, it takes up a lot of memory space to deal with the huge collection of functionalition.
The SAX parser uses the client application to handle analysis events through existing instances of objects on the specified platform. The SAX parser controls the entire process and "pushes" the data out to the processor, which in turn accepts or rejects the data. The advantage of this mode is that it requires very little memory space.
The .NET Framework processing XML fully supports XMLDOM mode, but it does not support SAX mode. Because the .NET Framework supports two different analysis modes: the XMLDOM parser and the XML reader. It obviously doesn't support SAX parsers, but that doesn't mean it doesn't provide the same power as SAX parsers. Through the XML reader SAX all the functions can be easily implemented and more effective use. Unlike the SAX parser, the. NET Framework reader operates entirely under the client application In this way, the application itself can "push" only the data that is really needed and then jump out of the XML data stream. The SAX analysis pattern deals with all the information that is useful and useless to the application.
The reader works based on the .NET Framework stream mode, which works like a database cursor. Interestingly, classes that implement a cursor-like parsing pattern provide underlying support for XMLDOM parsers in .NET Framework. XmlReader and XmlWriter abstract classes are the basic classes of all XML classes in .NET Framework, including XMLDOM class, ADO.NET driver class and configuration class. So you have two options for dealing with XML data in the .NET Framework. Use XmlReader and XmlWriter classes to process XML data directly, or use XMLDOM schema to process.
XML readers support a programming interface that connects XML documents and "pushes out" the data you want. If you take a closer look at the reader, you will find that the reader works similar to how our desktop application fetches data from the database. The database service returns a cursor object that contains all query result sets and returns a reference to the start address of the target dataset. The client of the XML reader receives a reference to the reader instance. This example extracts the underlying data stream and renders the extracted data as a XML tree. The reader class provides read-only, forward cursors, and you can scroll through each piece of data in the result set using the methods provided by the reader class. From the reader, the XML document is not a tag text file, but a serialized collection of nodes. It is a special cursor mode in the .NET Framework; you can't find any other similar API function in the .NET Framework.
There are several differences between a reader and a XMLDOM parser. XML reader is entry-only, it has no concept of father, son, ancestor, brother node, and is read-only. In the .NET Framework processing XML, reading and writing XML documents is divided into two completely different functions, which are accomplished by the XmlReader and XmlWriter classes, respectively. To edit an XML document, you can use the XMLDOM parser.
Net framework deals with the xml main package System.Xml namespace, while xml serialization is in the System.Xml.Serialization namespace. * briefly talk about the concept of DTD.
DTD (Document Type Definition, document type definition) is a specification that enables seamless data exchange between business organizations. For example, if two companies in the same industry An and B want to exchange data with XML files, company A uses the price tag to represent the price information of their products, while company B may use the price > to represent price information. If a XML application reads the information in their respective XML files, and if it only knows that the price information is indicated in the price tag, then Company B's price information cannot be read, and an error will occur. Obviously, for entities that want to use XML files to exchange information, there must be a convention between them-- which tags can be used to write XML files, which child elements can be included in parent elements, the order in which each element appears, how attributes in elements are defined, and so on. Such a person can help us easily write an application based on this DTD and go to the Internet to automatically retrieve what we are interested in. This is the so-called DTD,An and B companies must follow a specification when exchanging data.
There are already several defined DTD in the way the .NET Framework handles XML, such as MathML, SMIL, and so on. MathML (Mathematical Markup Language ) is a standard based on XML, which is used to write mathematical symbols and formulas on the Internet. It is proposed by the W3C working Group on Mathematics. Because the structure of mathematical symbols and formulas is complex and there are many kinds of logical relations between symbols, the format of MathML is very complicated. This thing is so complicated that I don't bother to study it. Just let it go. SMIL seems to be pronounced smile and is used to manipulate multimedia clips (an organic, intelligent combination of multimedia clips).
Looks like this thing is really good! The SMIL language is a set of well-defined and very simple tags. It is used to specify when, where and in what way multimedia clips (including audio files, video files, animation, pictures, text, etc.) are played.
After reading the above, have you mastered how the .NET Framework handles XML operations? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.