the Internet Windows Android

Using XML in the Delphi environment. Using XML Document Object Model Creating an XML in Delphi Xe Flap

Welcome! This blog is devoted to the Internet and computers, and, more precisely, they were dedicated to them.

Probably it is immediately seen that many years have not appeared on the site for many years. Yes, this is the fate of most blogs. Once this project was an ambitious undertaking, and the author, as in many others who wrote at the time, were large-scale plans to become one of the best Russian bloggers. Well, if you look now, then from those blogs that were created simultaneously with mine, most had already dissolved in eternity. And I tritely became missing time blog. So yes, it is no longer updated. Although I once won in this site in the 2011 Blog Competition.

I even had the idea to remove all this, but then I revised the old materials, and realized that they could still be useful to readers. Yes, some articles are outdated (if I have enough strength, they will receive the appropriate marks), but the site, for example, can be useful to beginners - here you can read about the basic concepts of the Internet, learn to customize the Internet, Windows or even decide to go to Linux. So look at the headings and select the one that is suitable for you.

And, after all, I hope it is more than just a blog, but a real Internet guide. The site can be found in the directory mode, where all available articles are structured by categories. And who knows maybe, new quality articles will begin to appear here.

Sander

Picodi.ru is a discount portal from International Coupons, a Polish expert in saving and cheap purchases. Poles are considered one of the most economical nations in the world, therefore it is not surprising that this type of project has grown from the Polish startup KODYRABATOWE.PL. What can be useful to this portal to an ordinary Internet user in Russia?

Modern android telephones are more than phones. You get used to the set of installed programs, to the history of your calls and text messages, collections of photos and a lot. But the time goes, and the fully arranged device starts to slow down, bug, or simply loses a presentable view because of the chipping on the case or scratches on the screen. There is a question of choosing a new phone and changing the Android phone. And if the question of choice, we will now bypass the party now, then "moving" to a new phone remains a serious problem - I absolutely do not want to start all the data from scratch. Here we will talk about this today.

Most of the readers of this blog, most likely, never faced versions of version control and will not come up in the near future. And sorry. This extremely user-friendly invention is widely used by programmers, but, in my opinion, it could be very useful and to those who actively work with the texts. But, probably, there is no version control system now, which it would be easy to start using for the "office" (Microsoft Office) of work. Nevertheless, I think that the material set forth in the article may be interesting for all readers.

If you thought about how from your TV watch movies over the network and access the Internet, this article is for you. No, I know that some TVs have the functionality of Smart TV, but I have never seen it work fine. Apparently, therefore, Google's recently demonstrated a completely stunning device, immediately ended with a sensation. We are talking about the media streamer Chromecast (chromkast), a more perfect and affordable version of last year's favored player Nexus Q.

Dongle Chromkast, the dimensions of which do not exceed 2 inches, connects to the HDMI port of the TV and allows you to enjoy watching streaming web content. To control the streamer, you can use any device (tablet, PC, smartphone) based on the IOS, Windows, Android or Mac OS operating platform.

This article is devoted to the Android system memory device, problems that may arise due to its lack and how to solve them. I myself did not have so long ago that my Android phone began to regularly issue messages about a shortage of memory when trying to establish a particular application. What was very strange for me despite the fact that on the description on the market there should have been about 16GB, and I also increased this volume using an additional memory card. However, the problem was, and I had to thoroughly tinker before I found the right solution that does not require the receipt of root access or the full recovery of the phone to the factory state.

Recently, much attention is paid to building e-business systems, or as they are also called - B2B (Business to Business). Given the recommendations on the construction of exchange streaming systems of coordinating Internet technologies of the body - WWW Consortium: emphasis is made towards XML technologies and building XML document exchange systems.

The advantage of using XML in e-business is the high efficiency of B2B systems at low costs for its creation due to a clear and visual representation of structured information, the ability to use modern network protocols and creating real-time business systems.

Independence of the presentation of information in the form of XML documents allows different, participating in the electronic business, to produce independent from each other by.

In all systems, the exchange is usually built by the same scheme using HTTP requests. The SSL protocol is applied as the SSL protocol (but this is a separate topic).

One of the possible options for processing XML messages is to build BIN / CGI (ISAPI) -News or COM (server) components forming or processing XML documents.

On the one hand, the application acts as a client, which in POST mode issues an HTTP query, on the other hand, is a WEB server on the side of which the query processing and an answer is processed. The information exchange uses XML documents.

One of the most effective implementation options is the use of an existing XML parser supporting the DOM model. Such a parser is a distributive supply of Win`98 or an integral part of IE 4.7 and above (for Win`95) and represents the COM server located in the msxml.dll library.

The component object model (COM) is encapsulated data and methods into a single essence and a way to access them through the interface system. Delphi is simply accessible to access to the COM object classes (several classes may be included in one COM server). Access to objects is carried out by initializing the class instance through the interface system. Description of the interfaces is carried out by the interface definition language (IDL), which is possible to carry out the means of the medium automatically.

Delphi means Imports from the COM server msxml.dllThe IDL interface description files are built and the binary description file of the library type is TLB. This operation is carried out through the system menu: Project | Type Library Import:(picture 1). The following dialog box appears (Figure 2), in which you want to select a COM object (in our case, the object is registered as "Microsoft.xmldom (Version 2.0)") and create a TLB file (button Create Unit.). Using the TLB file, the environment generates "Paskalevsky" file description of the COM server - MSXML_TLB.PAS

The MSXML_TLB.PAS file describes all interfaces, constants and COM servers.

For access to the objects of the COM element, it is necessary in the directive Uses.add the name of the library description file (msxml_tlb.pas). Below is the simplest program that uses the DOM standard MSXML.dll analyzer, which downloads the XML document and displays it in the Memo1 text box element.

uses. Windows, Messages, Sysutils, Classes, Graphics, Controls, Forms, Dialogs, Oleserver, MSXML_TLB, STDCTRLS; type TForm1 \u003d. class(TForm) Button1: Tbutton; Memo1: TMemo; procedure. Button1Click (Sender: Togject); end; var. Form1: TForm1; implementation ($ R * .dfm) Procedure.TForm1.Button1Click (Sender: Togject); // Declaration of Soklass object DomDocument; var.codoc: Codomdocument; // class, consistent with the iDomDocument interface; var.Doc: IXMLDOCUMENT; begin. // Creating an instance of the DomDocument object; Doc: \u003d Codoc.create; // call a mode method of an instance of the domdocument object; Doc.Load ("data.xml"); // Access to the XML property instance of the domdocument object; Memo1.Text: \u003d doc.xml; end; end.

DOM Concept - Object Document Model

Each XML document is represented as a set of a plurality of objects (classes), with which access to individual elements (object fields) is possible. DOM - interface describes access to both simple domstring or characterdata objects and parts or separate XML elements of the document: DomfragmentElement, Domnode, Domelement.

The following are the most important properties and methods of XMLDomDocument, XMLDOMNODE, XMLDOMNODELIST. It should be noted that the MODEL MSXML.DLL XML analyzer, the MSXML.DLL XML analyzer, presented below, are used by the MSXML.DLL XML analyzer than the DOM Consortium approved by the W3C model.

A more complete description of the interface DOM objects can be found on

Xmldomdocument object
Represents the top level of the object hierarchy and contains methods for working with a document: its downloads, analysis, creating elements, attributes, comments in it, etc. .
Properties
Async. Property Identifying Current Processing Mode
Parseerror Returns a reference to the XMLDOMPARSEERROR error processing object
Enable - Disable document verification.
uRL Returns the URL of the document
documentElement Contains a reference to the root element of the document as an XMLDOMEMEMENT object.
Methods
load (URL)
loadXML (XMLString)
Loads an XML document
save (Objtarget) Saves the XML document in the file
aBORT. Interrupting the process of downloading and processing the document.
createAttribute (Name) Creates a new attribute with the specified name for the current item.
createNode (Type, Name, Namespaceuri) Creates a node of the specified type and title
createElement (TagName) Creates a document element with the specified name.
createTextNode (DATA) Creates text inside the document
getElementsBytagname (TagName) Returns a link to the collection of document items with the specified name
nodeFromid (idstring) Search element by identifier

XMLDOMNODE object
XMLDOMNODE object that implements the basic DOM interface Node., Designed to manipulate with a separate knot of a document tree. Its properties and methods allow you to receive and change full information about the current node - its type, name, full name, its contents, a list of child elements, etc.
Properties
nodeName, Basename. Returns the name of the current node.
prefix. Returns the namespace prefix.
datatype. Defines the content type of the current node
nodeType, NodeTypestring Returns the type of the current node:
attributes. Returns a list of attributes of the current node as the XMLDOMNAMENDEMAP collection.
tEXT. Returns the contents of the current support in the form of text.
xml Returns the XML representation of the current support.
nodeValue. Returns the contents of the current node.
childnodes. Returns a list of child elements as xmldomnodelist.
fIRSTILD, LASTCHILD. Returns the first / last child element
previousSibling, NextSibling Returns the previous / next nursing element.
parentnode. Contains a reference to the parent element.
ownerdocument Returns the pointer to the document in which the current node is located.
Methods
aPPENDCHILD (NEWCHILD) Adds a new child element to the current node.
iNSERTBEFORE (NEWCHILD, REFCHILD) Inserts a child node, having it in the current subtree "left" of the node specified by the Refchild parameter.
cloneNode (Deep) Create a copy of the current element.
getAttribute.(Name)
getAttributeNode. (Name)
setAttribute (Name, Value)
setAttributeNode (XMLDOMAttribute)
Access to attributes (creating, reading, writing) object. Name - Attribute Name, Value - its value. Returns the value of the XMLDOMAttribute object.
replacechild (Newchild, OldChild) Removechild (OldChild) Replacing the OLDCHILD object of the current list of subsidiaries on NewChild. Removing the OLDCHILD object
selectNodes SELECTSINGLENDE (PATTERNSTRING) Returns the XMLDOMNODELIST object selected by search pattern or first node
tRANSFORMNODE (STYESHEET)
transformNodetoBject (StyleSheet, OutputObject)
Assigns a style table to support the current node and returns the string - the result of processing. A reference to the DomDocument object is transmitted as a parameter, in which the XSL instructions are located.

Using XML in business.

For a clearer picture, an explanation is necessary, and why all this is necessary with what to understand how it works:

When building a B2B or corporate ERP system, when organizing an information exchange of XML documents between enterprises or branches of the Prom-I, an effectively proven information system is used on the basis of available Web servers on HTTP protocols.

On the one hand, the application acts as a client, which in POST mode issues an HTTP query, on the other hand, the WEB server is on the side of which the request is processed and the response. XML documents are used as exchanging.

For example, in a simple corporate ERP system of the accounting program (ACS accounting), it is necessary to form a certain request for an invoice and transfer it to a branch that has a warehouse (ACS Warehouse). ART is a similar setting of the problem when creating a B2B of the system, when an enterprise A requests the availability of products (makes an order for the purchase) from the supplier V.

Enterprise A and his program acts as a client. The warehouse serves the supplier in who has a warehouse bd complex on the SQL server. Exchange is carried out through a corporate web server supplier V.

Below is the following typical exchange algorithm:


Figure 3.
  1. Enterprise A.initiates process A.(Product order), which acts as a Web client.
  2. Process A.generates an XML document (for example, an invoice) and transmits it as a POST HTTP query to a Web Supplier Server V. As an URI - a processing application identifier is used. URI may be the same as for all types of documents or individual for each type. It all depends on the structure of the B2B (Web) server.
  3. WEB server analyzes the request and generates the server Process B.By passing an XML document as a parameter.
    The process in the web server is started and processed either as ASP page, CGI (ISAPI) - application or java Sevrlet (server application)
  4. Process B.- Generates a request to the SQL database server.
  5. The SQL server makes the necessary operations in the database, forms the answer and returns it. Process B..
  6. On the answer from the SQL server Process B. Generates an XML document (answer) and lets it as an answer to the HTTP request to the client application.
  7. Further, depending on the situation on the client side, either a new HTTP query is formed, or the session ends.

A few words about the organization of document management.

The general rule of development of the XML exchange system is:

  • firstly- development of the circuit of the flow of electronic documents and their structure;
  • secondly- development of tables of functions of processes (subprocesses) i.e. What function in relation to which XML document will implement each process.

Each XML document, like an HTML document, should consist of a message header (information prisoner) and a message body (for the query this information framed by tagging to respond to the request). In order for the XML document to be correctly formed, it is necessary for its two components of the "header" and "request" to framed tags, for example. The view of the standard document is presented below:

The title (Figure 4), in contrast to the HTML of the document, should contain different kind of service information, including information about the type of document transmitted and processing process. The informational processing of the document is received, i.e. The meaningful part is framed by tag. It should be noted that the header structure should be united for all types of documents.

For the process running by the server, the processing algorithm is preferably (but not necessary) to build as follows:


Figure 6.

Some principal moments when creating a client part

As already explained, when creating an XML document uses its representation in the form of a DOM model. Below is an example of the text of the Delphi text of the XML message header program.

procedure.Tthread1.HeaderCreate (Sender: Togject); var. // Classes Announcement is needed to create Codoc: Codomdocument; // XmldomDocument object Doc: DomDocument; R: ixmldomelement; Node: ixmldomelement; // Domtext TXT: IXMLDOMTEXT; // Domattribute ATTR: ixmldomattribute; begin. // Creating Dom Document Doc: \u003d Codoc.create; Doc.set_async (false); // initial initiation DOM document Doc.Loadxml ("
"); // Creating Domelement (Tag<Sender.>) Node: \u003d doc.createElement ("Sender"); // Creating a Text Node " LLC "Typhoon"" TXT: \u003d doc.createTextNode ("LLC" Typhoon "); // Assigning a node<Sender.\u003e Value // Text Node " LLC "Typhoon"" Node.appendchild (TXT); // Adding an item<Sender.\u003e in the root of the document as a subsidiary R.APPENDCHILD (Node); <From.> Node: \u003d doc.createElement ("From"); TXT: \u003d Doc.CreateTextNode ("http://tayfun.ru/xml/default.asp"); Node.appendchild (TXT); R.APPENDCHILD (Node); // Similar operations for Tag<To.> Node: \u003d doc.createElement ("To"); TXT: \u003d Doc.CreateTextNode ("http://irbis.ru"); Node.appendchild (TXT); R.APPENDCHILD (Node); // Create Domelement () Node: \u003d doc.createElement ("TypeDocument"); // Creating an XMLDOMATTRIBUTE node ATT: \u003d doc.createAttribute ("ID", "Order"); // Node.APPendchild (ATT); R.APPENDCHILD (Node); end;

It should be noted that the announcement of the CODOC: CodomDocument and Doc: DomDocument variable, as well as the creation of the Create method (doc: \u003d codoc.create;) is carried out once. The declaration of the variable is in the section of the description of global variables, and not in the local procedure, as demonstrated for visibility in this example (i.e. one global variable of the DomDocument type one program module).

The result of the above program will be the created header, in relation to our example of the XML document: depicted in Figure 5.


Figure 5.


Figure 6.

The main advantage of transmitting information in the form of XML documents is that it is possible to form a message using the independent structure of the tables in the DBMS both on the received and on the transmitted side. Using our example, let it be required to transfer information about the invoices of the enterprise A, from the DBMS of the structure shown in Figure 6

To form an XML document containing an invoice, an initially built SQL request (query a) with information about the Invoice:

SELECT * From invoice_general Where. InvoicEnum \u003d: Num SELECTGoods, quulity, Price, hz_cod From.Goods Where. InvoicEnum \u003d: Num //: Num - the parameter that specifies the invoice number.

Below is part of the program forming the body of the XML document:

procedure. Tthread1.databodycreate (sender: tobject); var. // Classes and XmldomDocument // Codoc: Codomdocument; // must be global, for the entire module. // Doc: DomDocument; // Announcement of Domelement Objects R: ixmldomelement; // Domelement; Node, Node2: ixmldomelement; Node3, node4: ixmldomelement; // Domtext TXT: IXMLDOMTEXT; Str: String; // InvoicEnumber: integer; - Global variable - // Masching 987654 // Querya, QueryB: String; - Global variable, // Maintaining a request to request // Querya - request and general information on invoice // QueryB - Query B Information about the goods described in // Invoice (see Text) begin. Query.close; // See on the text "Request A" Query.Text: \u003d Querya; // Request execution Query.execsql; Query.open; // Get the address of the root element R: \u003d doc.get_documentElement; Node2: \u003d doc.createElement ("Request"); // Create Domelement (TAG) Node: \u003d Doc.CreateElement ("Invoice"); // Adding an item to the root R.APPENDCHILD (Node2); // Adding an item in Node2. AppendChild (Node); // Create Domelement (TAG) Node3: \u003d doc.createElement ("Depurture"); // Adding an item in Node. AppendChild (Node3); // Appeal to the "Depurture" field Str: \u003d Query.fieldByname ("Depurture"). Asstring; // Creating a text node \u003d field value // node assignment value // Text node, variable str Node.appendchild (TXT); // Similar operations for Tag , , // , // (field db "Consignee") Node: \u003d doc.createElement ("DESTINATION"); // The name of the database field may not coincide with the name STR: \u003d Query.fieldByname ("Consignee") .Asstring; // Taga, in this advantage of use TXT: \u003d Doc.CreateTextNode (STR); // DOM interface before DBMS having the support of the XML interface, // type Oracle 8i or MS SQL 2000 Node.appendchild (TXT); ... // Formation of a request for goods specification // Closes access request Query.close; // See on the text "Request in", Info. About products Query.Text: \u003d QueryB; // Assigning parameter values Query.params.asinteger: \u003d InvoicEnumber; // Request execution Query2.execsql; // Opening access to request data Query.open; // Create Domelement (TAG) Node3: \u003d Doc.CreateElement ("IMEMS"); // Adding an item in Node. AppendChild (Node3); // Cycle on all requests while not. Eof.Query. do. Begin node4: \u003d doc.createElement ("IMEM"); // Adding an item in Node3.APPendchild (Node4); // Data generation for Tag Str: \u003d Query.fieldByname ("Price"). Asstring; TXT: \u003d Doc.CreateTextNode (STR); Node.appendchild (TXT); ... // Similar operations for tags , , end; end;

As a result of this procedure, the following text of the XML document is formed:


The Open method is used to form a query. Ixmlhttprequest:

procedure. Open (Const Bstrmethod, - Method Type \u003d "POST" BSTRURL, - URL VARASYNC Server Address, - Asynchronous / Synchronous Communication Mode \u003d True Bstruser, - Username for BSTRPASSWORD authentication) - Password

Creating a server part of document processing

As noted earlier, the processing of HTTP request can be carried out either CGI applications or Java servlets. Possible options for writing ASP pages. But in this case, data transmission is possible only by the "Get" using the query string. Although, the HTTP processing of the ASP page request works more efficiently than the CGI application. However, in my opinion, without any difference, how to process, and more importantly to solve the question - how to build a processing program, and not with what means.

If we reviewed an XML document formation options from the previous chapter, then the task of the server application is the opposite of XML documents. Below is part of the program that analyzes the XML document:

procedure.Tthread1.dataparser (sender: tobject); var. // Announcement of Domelement Objects R, Fnode: ixmldomelement; Str, FileName: String; Parm: String; // Soklass announcement and CodocXML, CodocxSl, Codocresult: Codomdocument; // XmldomDocument object XMLDOC, XSLDOC, ResultDoc: DomDocument; // httpstr: string; - A global variable containing the HTTP query string Begin. Xmldoc: \u003d codocxml.create; Xmldoc.Loadxml (httpstr); // Get the address of the root element R: \u003d doc.get_documentElement; // Obtaining the value of the element Fnode: \u003d R.SelectSinglenode ("// TypeDocument"); // Get an attribute value id \u003d "Order" FileName: \u003d Fnode.getAttiBute ("id"); // And forming the file name Order.xsl FileName: \u003d FileName + ". XSL"; // Creating a document XSLDOC Xsldoc: \u003d codocxsl.create; Xsldoc.loadXML (FileName); // Creating an XMLDOC document Resultdoc: \u003d codocresult.create; // Setting the synchronous processing mode Resultdoc.set_async (false); // Installing Debuting Check Resultdoc.validateonparase: \u003d true; // Collapse XMLDOC by XSL template XMLDOC.TransFormNoC, ResultDoc (XSLDOC, ResultDoc); // variable STR is assigned to text value // Resulting Document. STR: \u003d resultdoc.text; // Search element Fnode: \u003d R.Selectsinglenode ("// InvoicEnumber"); // and getting the value of the element Parm: \u003d Fnode.Text; // Closes access request Query.close; Query.Text: \u003d STR; // Assigning the value of the parameter Query.params.asstring: \u003d PARM; // Request execution Query.execsql; end;

The entire range of parsing is to apply the XSL template, which is formed for each type of document individually. The analysis result is the SQL query string. In consequence, the execution of the generated SQL query string will make the necessary changes in the DBMS.

The advantage of using parsing through the template is also in the fact that it turns out some data flexibility, and the complete independence of the operation of the algorithm from the program code is obtained. Below is the text of the XSL template as used for processing document type.

INSERT INTO TABREG (from, to, typedoc, body) Values \u200b\u200b(" ", "", "") INSERT INTO GOODS (InvoicEnumber, Name, Price, Quality) Values \u200b\u200b(": Num", " ", "", " ")

Explaning the above example, it should be noted that the use of pairs of tags and is formal, because After parsing, at least one node should be present in the resulting XML document. The resultdoc.Text method assigns the text value obtained during the analysis of the XML document ResultDoc. In this case, the value is all that the pairs of tags are framed and, i.e. We have formed a SQL request.

Another feature of writing the program should be noted the possibility of using the SQL parameter : num. Using the parameter allows you to simplify the text of the XSL template. Definition The value of the corresponding elements of the XML document nodes is determined initially selecting the name of the corresponding node, for example:

Briefly about xsl

XSL abbreviation comes from Extensible Stylesheet Language - style table formatting language (XML data). As it is clear from the Extensible StyleSheet Language (XSL) header (XSL) is used to format XML data. By definition of W3C XSL consists of two parts:

  • XSLT - XSL Transformation. The language used to convert or format (transform) XML documents. Thus, using XSLT, we can get different sections of multiple data and data presentation forms.
  • Formatting elements. These elements include all elements of typographical data design, after they are processed using XSL. Used only to form HTML pages.

Using XSLT, we can select the data from the XML file you need, and arrange them in the form to provide the user. For example, in our case, we transformed XML data as a SQL query. The classic XSL application is usually formatting data as an HTML pages or a rare representation in the form of RTF files.

XSL file describes the template (Template), according to which the XML data conversion will be performed. Returning to XSL templates, the following elements can be allocated in XSLT (directives):

XSL directive description
xSL: Apply-Templates Directive, indicating the application of the appropriate templates attribute SELECT \u003d "Template name"
xSL: attribute. creates the attribute tree and adds it to the output element, the Name \u003d "attribute name" parameter, namespace - URI on the namespace (namespace prefix)
xSL: Call-Template causes a template, attribute Name \u003d "URI on the template"
xSL: Choose.
xSL: WHEN.
xSL: Otherwise.
making a selection by condition XSL: WHEN EXPR \u003d "Calculating expression on Script",
language \u003d "Language-Name"
test \u003d "Calculated expression"
xSL: comment generates a comment on the output document
xSL: Copy.
xSL: Copy-of
copies the current node in the output source or inserts the document fragment to the node where the select \u003d "Name of the source node" attribute
xSL: Element creates an output element by name, attribute Name \u003d "element name", namespace \u003d "URI reference to the namespace"
xsl: for-each re-apply template to all nodes list nodes, SELECT attribute sets a list of nodes.
xSL: if. conditions check is set by the TEST attribute as an expression
xSL: include includes an external template, attribute HREF \u003d "URI REFERENCE"
xSL: Output specifies the output result, the Method attribute may have "XML", "HTML" or "Text"
xSL: Param specifies the parameter value, the name \u003d "parameter name" attribute, select \u003d "value"
xSL: PROCESSING-INSTRUCTION creates instructions for processing, attribute Name \u003d "Name Process Instructions"
xSL: Sort. sorts many nodes, attributes select \u003d "node name", data-type \u003d data type ("text" | "Number" | qname), Order \u003d Sort direction ("Ascending" | "Descending")
xSL: StyleSheet. defines the XSL template document, is the root element for XSLT
xSL: Template. specifies the XSL template, the Name \u003d "URI prefix attribute to the template name", match \u003d "Note to the node to which the template applies"
xSL: TEXT. generates text to output stream, the disable-output-escaping \u003d "yes" or "no" attribute indicates the ability to generate ESC characters
xSL: Value-of inserts the value of the selected node as the text, the SELECT \u003d "pointer to the node" attribute from which the value is taken
xSL: variable specifies the value of the variable boundaries, the Name attribute \u003d "variable name", SELECT \u003d "Calculate the value of the variable"
xSL: WITH-PARAM applies the parameter to the template, the name attribute \u003d "parameter name", SELECT \u003d expression to calculate the current context, the default value "."

Conclusion

In conclusion, it should be noted that using the standard XML parser msxml.dllit is not the only means of parsing and creating XML documents. For example, to create XML documents to effectively use components TPageProduser.and TTableProduser.. But this article only emphasizes the breadth and possibility of applying a DOM model in practice.

The author will be very grateful for feedback on the relevance of the topic, the overall content, style of presentation, as well as all the other comments that will help further improve the quality of writing a collection of articles and the release of books that covers the subject of the practical side of the use of XML documents in e-commerce. For more information on the practical side of the application of electronic documents, you can learn from www.edocs.al.ru on the author's website, it is also planned to place source texts and examples.

The XML language is increasingly used to store information, sharing it between applications and Web nodes. In many applications, this language is used as a basic storage of data in others - to export and import XML data. It follows from this that it is time for developers to think about how to use XML data in your own applications.

In this article, we will consider XML Document Object Model (DOM) and its implementation by Microsoft - Microsoft XML DOM.

The XML DOM is an object model that provides the developer objects to download and process XML files. The object model consists of the following main objects: XMLDOMDocument, Xmldomnodelist, Xmldomnode, XmldomnamedNodeMap and XMLDOMPARSEERROR. Each of these objects (except XMLDOMPARSEERROR) contains properties and methods to obtain information about the object, manipulate the values \u200b\u200band structure of the object, as well as move along the XML document structure.

Consider the main objects of XML DOM and give several examples of their use in Borland Delphi.

Using XML DOM in Borland Delphi

In order to use Microsoft XML DOM in Delphi applications, you must connect the appropriate type library to the project. To do this, we execute the Project | Import Type Library and in the Import Type Library dialog panel, select the Microsoft XML Version 2.0 library (Version 2.0), which is usually located in the Windows \\ System \\ MSXML.DLL file

After pressing the CREATE UNIT button, the MSXML_TLB interface module will be created, which will allow us to use the XML DOM objects: DomDocument, XmlDocument, XmlHttpRequest and a number of others implemented in the MSXML.dll library. The link to the MSXML_TLB module must be listed in the list of Uses.

XML DOM device

Document Object Model represents an XML document in the form of a tree structure consisting of branches. XML DOM software interfaces allow applications to navigate the document tree and manipulate its branches. Each branch can have a specific type (DomnodeType), according to which parent and subsidiaries are determined. In most XML documents, you can find branches of the Element, Attribute and Text branches. Attributes (attribute) are a special type of branch and are not subsidiary branches. For attribute management, special methods provided by XML DOM objects are used.

In addition to implementing the recommended World Wide Web Consortium (W3C) interfaces, Microsoft XML DOM contains methods that support XSL, XSL Patterns, Namespaces and data types. For example, the SelectNodes method allows you to use XSL templates syntax (XSL Pattern Syntax) to search for branches at a specific context, and the TRANSFORMNODE method supports the use of XSL to perform transformations.

Test XML document

As an example of an XML document, take the catalog of music CD-ROM, which has the following structure:

Empire Burlesque Bob Dylan. USA. Columbia. 10.90 1985 Hide Your Heart. Bonnie Tylor. Uk. CBS Records. 9.90 1988 ... Unchain My Heart. Joe Cocker. USA. EMI 8.20 1987

Now we are ready to start considering the object model XML DOM, familiarity with which will start with the XMLDOMDocument object.

XML document - XMLDOMDocument object

Working with the XML document begins with its download. To do this, we use the LOAD method that has only one parameter indicating the URL of the downloaded document. When downloading files from a local disk, only the full file name is specified (File: /// protocol in this case can be omitted). If the XML document is stored as a string, the LoadXML method should be used to download such a document.

To control the method of downloading a document (synchronous or asynchronous), the ASYNC property is used. By default, this property is true, indicating that the document is loaded asynchronously and control is returned to the application even until the document is fully loaded. Otherwise, the document is loaded synchronously, and then you have to check the value of the READYSTATE property to find out, the document loaded or not. You can also create an OnReadyStateChange event handler that will receive control when changing the value of the READYSTATE property.

Below is shown how to download an XML document using the LOAD method:

Users ... MSXML_TLB ... Procedure TFORM1.Button1Click (Sender: Togject); VAR XMLDOC: IXMLDOMDocument; Begin xmldoc: \u003d codomdocument.create; Xmldoc.async: \u003d false; Xmldoc.load ('C: \\ Data \\ Data.xml'); // // Here is the code that manipulates // XML document and its branches // XMLDOC: \u003d nil; end;

After the document is loaded, we can refer to its properties. Thus, the NodeName property will contain the #Document value, the NodeTypeString property is a Document value, the URL property is the File: /// C: /Data/Data.xml value.

Processing is mistake

Of particular interest are the properties associated with the processing of the document when it is loaded. Thus, the ParsEerror property returns an XMLDOMPARSEERROrror object containing error information that occurred during the processing process.

To write an error handler, you can add the following code:

VAR Xmlerror: IXMLDOMPARSEERROR; ... xmldoc.load ('C: \\ Data \\ Data.xml'); Xmlerror: \u003d xmldoc.parseerror; If xmlerror.errorcode.<> 0 THEN // // Here we process the error // Else Memo1.Lines.add (xmldoc.xml); ... xmldoc: \u003d nil;

To find out which information is returned in case of error, change the following directory item:

Empire Burlesque Bob Dylan. USA. Columbia. 10.90 1985

removing the closing element In the second line:</p><p> <CD> <TITLE>Empire Burlesque <ARTIST>Bob Dylan.</ARTIST> <COUNTRY>USA.</COUNTRY> <COMPANY>Columbia.</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> </p><p>Now write the code that returns the properties of the XMLDOMPARSEERROrror object:</p><p>Xmlerror: \u003d xmldoc.parseerror; If xmlerror.errorcode.<> 0 THEN WITH XMLERROR, MEMO1.LINES DO BEGIN Add ('file:' + url); Add ('Code:' + INTTOSTR (ErrorCode)); Add ('Error:' + Reason); Add ('Text:' + SRCTEXT); Add ('Row:' + inttostr (line)); Add ('Position:' + INTTOSTR (LINEPOS)); End else memo1.lines.add (xmldoc.xml); End;</p><p>and fulfill our application. As a result, we obtain the following error information.</p> <p>As can be seen from the above example, the information returned by the XMLDomparseerror object is enough to localize the error and understand the reason for its occurrence.</p> <p>Now restore the closing item <TITLE> In our document and continue the discussion of XML DOM.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h2> Access to the document tree</h2> <p>To access the document tree, you can either get the root element and then go through its subsidiaries, or find some specific branch. In the first case, we get the root element through the DocumentElement property, which returns an object of type XMLDOMNODE. Below is shown how to use the DocumentElement property in order to obtain the contents of each child element:</p><p>VAR NODE: ixmldomnode; Root: ixmldomelement; I: integer; ... root: \u003d xmldoc.documentElement; For i: \u003d 0 to root.childnodes.length-1 do begin node: \u003d root.childnodes.Item [i]; Memo1.Lines.add (Node.Text); End;</p><p>For our XML document, we get the following text.</p> <p>If we are interested in some kind of specific branch or branch level below the first subsidiary, we can use either the NodeFromid method or the GeTElementByTagName method of the XMLDOMDocument object.</p> <p>The nodefromid method requires specifying a unique identifier defined in XML Schema or Document Type Definition (DTD) and returns a branch with this identifier.</p> <p>The GetElementByTagName method requires an indication of a string with a specific element (tag) and returns all branches with this item. Below is shown how to use this method to find all performers in our CD-ROM directory:</p><p>Nodes: ixmldomnodelist; Node: IXMLDOMNODE; ... nodes: \u003d xmldoc.getelementsbytagname ('artist'); For i: \u003d 0 to nodes.length-1 do begin node: \u003d nodes.Item [i]; Memo1.Lines.add (Node.Text); End;</p><p>For our XML document, we will get the following text.</p> <p>Note that the XMLDOMNODE selectnodes method provides a more flexible way to access the branches of the document. But about it is slightly lower.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h2> Document branch - XMLDOMNODE object</h2> <p>The XMLDOMNODE object is a document branch. We have already encountered this object when the root element of the document was obtained:</p><p>Root: \u003d xmldoc.documentElement;</p><p>To obtain information on the branch of the XML document, you can use the properties of the XMLDOMNODE object (Table 1).</p> <p>To access data stored in the branch, usually use the NodeValue property (available for attributes, text branches, comments, instructions for processing and CDATA sections), or the Text property that returns the text content of the branch, or the NodeTypeDValue property. The latter, however, can only be used for branches with typed elements.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h3> Moving on the document tree</h3> <p>The XMLDOMNode object provides a variety of ways to move through the document tree. For example, to access the parent branch, the ParentNode property is used, access to child branches is carried out through the Childnodes properties (XMLDCHILD type), FirstChild and Lastchild (type XMLDOMNODE), etc. The OwnerDocument property returns an XMLDOCUMENT object that identifies the XML document itself. The above properties make it easy to move through the document tree.</p> <p>Now I will overcome all the branches of the XML document:</p><p>Root: \u003d xmldoc.documentElement; For i: \u003d 0 to root.childnodes.length-1 do begin node: \u003d root.childnodes.Item [i]; If node.haschildnodes then getchilds (node, 0); End;</p><p>As noted above, the selectnodes object XMLDOMNODE provides a more flexible way to access the branches of the document. In addition, there is a SELECTSINGLENDE method that returns only the first branch of the document. Both of these methods allow you to specify XSL templates to search for branches.</p> <p>Consider the process of using the SELECTNODES method to extract all branches that have a CD branch and inflation.</p><p>Root: \u003d xmldoc.documentElement; Nodes: \u003d root.selectnodes ('CD / Price');</p><p>The NODES collection will be placed all switter Price CD branches. The discussion of XSL templates will return a little later.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h3> Manipulation by daughter branches</h3> <p>For manipulation of subsidiaries, we can use the methods of the XMLDOMNode object (Table 2).</p> <p>In order to completely delete the record of the first disk, you need to perform the following code:</p><p>VAR XMLDOC: IXMLDOMDocument; Root: ixmldomnode; Node: IXMLDOMNODE; Xmldoc: \u003d codomdocument.create; Xmldoc.async: \u003d false; Xmldoc.load ('C: \\ Data \\ Data.xml'); // Get the root element root: \u003d xmldoc.documentElement; Node: \u003d root; // Remove the first subsidiary node.Removechild (Node.firstchild);</p><p>Please note that in this example we remove the first subsidiary. How to remove the first element of the first subsidiary, is shown below:</p><p>VAR XMLDOC: IXMLDOMDocument; Root: ixmldomnode; Node: IXMLDOMNODE; Xmldoc: \u003d codomdocument.create; Xmldoc.async: \u003d false; Xmldoc.load ('C: \\ Data \\ Data.xml'); // Get the root element root: \u003d xmldoc.documentElement; // And the first subsidiary node: \u003d root.firstchild; // Remove the first subsidiary node.Removechild (Node.firstchild);</p><p>In the example above, we did not remove the first branch. <CD>…</CD>, and the first element of the branch - <TITLE>….

Now add a new branch. Below is a code showing how to add a new record of music CD-ROM:

Var Newnode: ixmldomnode; Child: ixmldomnode; ... // Create a new branch - Newnode: \u003d xmldoc.createnode (1, 'CD', ''); // Add element Child: \u003d xmldoc.createnode (1, 'title', ''); // Add a newnode.appendchild (Child) element; // and set its value of child.text: \u003d 'Pink Floyd'; // Add element <ARTIST> Child: \u003d xmldoc.createnode (1, 'artist', ''); // Add a newnode.appendchild (Child) element; // and establish its value of Child.Text: \u003d 'Division Bell'; // Add element <COUNTRY> Child: \u003d xmldoc.createnode (1, 'Country', ''); // Add a newnode.appendchild (Child) element; // and set its value of child.text: \u003d 'UK'; // Add element <COMPANY> Child: \u003d xmldoc.createnode (1, 'Company', ''); // Add a newnode.appendchild (Child) element; // and set its value Child.Text: \u003d 'EMI Records Ltd.'; // Add element <PRICE>Child: \u003d xmldoc.createnode (1, 'Price', ''); // Add a newnode.appendchild (Child) element; // and establish its value of Child.Text: \u003d '11 .99 "; // Add an element <YEAR> Child: \u003d xmldoc.createnode (1, 'year', ''); // Add a newnode.appendchild (Child) element; // and establish its value of Child.Text: \u003d '1994'; // and add the root.appendchild branch (newnode); ...</p><p>The above code shows the following sequence of actions to add a new branch:</p> <ul><li>Creating a new branch using CreateNode: <ul><li>creating an item using the CreateNode method;</li> <li>adding an element to the branch by the APPENDCHILD method;</li> <li>setting the value of the element through the TEXT property;</li> <li>... repeat for all items.</li> </ul></li> <li>Adding a new branch to the document by AppendChild.</li> </ul><p>Recall that the AppendChild method adds a branch at the end of a tree. To add a branch to a specific place of the tree, you need to use the InsertBefore method.</p> <h2> Set of branches - XMLDOMNODELIST object</h2> <p>The XMLNodelist object contains a list of branches that can be built using the SelectNodes or GetElementsByTagname methods, and is also obtained from the Childnodes property.</p> <p>We have already considered the use of this object in the example given in the section "Moving on the document tree". Here we also give some theoretical comments.</p> <p>The number of branches in the list can be obtained as the value of the Length property. The branches have indices from 0 to Length-1, and each individual branch is available through an Item array element with the corresponding index.</p> <p>Moving on the list of branches can also be carried out using the NEXTNODE method returning the next branch in the list, or Nil, if the current branch is the latter. To return to the top of the list, you should call the Reset method.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h2> Creating and saving documents</h2> <p>So, we looked at how you can add branches and elements to existing XML documents. Now create an XML document "on the fly". First of all, we will remind you that the document can be loaded not only from the URL, but also from the usual string. Below is shown how to create a root element, which can then be used to dynamically build the remaining elements (which we have already considered in the section "Manipulation of subsidiaries"):</p><p>VAR XMLDOC: IXMLDOMDocument; Root: ixmldomnode; Node: IXMLDOMNODE; S: WideString; ... S: \u003d ' <CATALOG></CATALOG>'; Xmldoc: \u003d codomdocument.create; Xmldoc.async: \u003d false; Xmldoc.loadxml (s); Root: \u003d xmldoc.documentElement; Node: \u003d xmldoc.createnode (1, 'CD', ''); Root.appendchild (Node); Memo1.lines.add (xmldoc.xml); ... xmldoc: \u003d nil;</p><p>After building an XML document, save it in the file using the SAVE method. For example:</p> <p>Xmldoc.save ('C: \\ Data \\ NewCd.xml');</p> <p>In addition to saving in the file, the SAVE method allows you to save an XML document in a new XMLDomDocument object. In this case, the document is full processing and, as a result, checking its structure and syntax. Below is shown how to save a document in another object:</p><p>Procedure TFORM1.Button2Click (Sender: Togject); VAR XMLDOC2: IXMLDOMDocument; Begin xmldoc2: \u003d codomdocument.create; Xmldoc.save (xmldoc2); Memo2.lines.add (xmldoc2.xml); ... xmldoc2: \u003d nil; end;</p><p>In conclusion, we note that the SAVE method also allows you to save an XML document to other COM objects that support iStream, IsetStream or IpescistStreaminit interfaces.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h2> Using XSL templates</h2> <p>Discussing the XMLDOMNODE object selectnodes method, we mentioned that it provides a more flexible way to access the branches of the document. Flexibility lies in the fact that as a criterion to select branches, you can specify an XSL template. Such templates provide a powerful mechanism to search for information in XML documents. For example, in order to get a list of all the names of music CD-ROM in our directory, you can follow the following query:</p><p>To find out whether discs of which performers are released in the United States, the request is formed as follows:</p><p>Nodes: \u003d root.selectnodes ('CD / ARTIST');</p><p>Below is shown how to find the first disk in the directory:</p><p>Nodes: \u003d root.selectnodes ('CD / TITLE');</p><p>and last:</p><p>Nodes: \u003d root.selectnodes ('CD / TITLE');</p><p>To find the discs of Bob Dilan, you can perform the following query:</p><p>Nodes: \u003d root.selectnodes ('CD [$ any $ arst \u003d "bob dylan"] / title');</p><p>and to get a list of disks released after 1985, we carry out the following query:</p><p>Nodes: \u003d root.selectnodes ('CD / TITLE');</p><p>A more detailed discussion of XSL syntax requires a separate publication. To intrigue readers and push further research, I will give only one small example of the possible use of XSL. Suppose we need to convert our directory to the usual HTML table. Taking advantage of traditional ways, we must sort out all tree branches and for each item obtained to form the corresponding tags <TD>…</TD>.</p> <p>Using XSL, we simply create a template (or style table), in which we indicate what and how to convert. Then we impose this template to our catalog - and ready: before us the text of the XSL template, which converts the directory in the table (Listing 2).</p> <p>The code for overlaying the XSL template to our catalog looks like this:</p><p>Procedure TFORM1.Button2Click (Sender: Togject); VAR XSLDOC: IXMLDOMDocument; Begin Xsldoc: \u003d codomdocument.create; Xsldoc.load ('C: \\ Data \\ Data.xsl'); Memo2.Text: \u003d XMLDOC.TransFormNode (XSLDOC); Xsldoc: \u003d nil; end;</p><p>By completing our discussion of XSL, it should be said that currently this language is actively used for transformation between different XML documents, as well as for formatting documents.</p> <table border="0" width="100%"><tr><td width="50%"> </td> <td width="50%"> </td> </tr></table><h2> Conclusion</h2> <p>For quite understandable reasons, in one article it is impossible to consider all Microsoft XML DOM objects and bring examples of their use. Here we only touched on the main issues of using XML DOM in applications. In tab. 3 shows all objects implemented in Microsoft XML DOM.</p> <p>ComputerPress 12 "2000</p> <p>Order Solving Tasks on Delphi <br> Delphi is the second programming language with which the students most often get acquainted in the learning process. This is the beginning of learning object-oriented programming. I, as a student, made for myself the conclusion that there is no easier method to master the language than to write a calculator on it. Even if you realize the elementary function of the addition of two numbers, this is already on a lot of light.</p> <p>Codegaear, Delphi 7, Lazarus is different compilers, programs that will be transferred to the machine code written by you, converting it into zoliki and one. These are all programs for creating programs, and not separate programming languages. These compilers use the Object Pascal programming language underlying the Delphi language, which is similar to the syntax similar to the usual Pascal, but is functional significantly different. <br></p> <h2>What is programming language syntax?</h2> <p>This is a format for writing various operators. For example, the "For" cycle on the Pascal has the following format: "For n: \u003d 1 to k do", etc.</p><p>In the C ++ programming language, the same cycle is written somewhat differently: for (n \u003d 1; n We write a calculator</p><p>This will give you to understand how objects with the program code are interacting, what is "variables", how mathematical functions work. All programming in any case will be a calculation. The game is also a program that constantly considers something, works with numbers and numeric functions. Programming is inseparable from mathematics.</p> <p>We use to write the Lazarus development environment. Its functionality is not as rich as, say, Codegear, but it is free access and is designed to study.</p><p>Opening the development environment, we see the shape and panel of the elements. Here is a form.</p> <p><img src='https://i1.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-24.jpg' width="100%" loading=lazy loading=lazy></p><p>Here is the element panel.</p><p>The first thing we will do is add the three items you need to implement the addition function of two numbers. We need: "Tedit" in the number of three pieces and "TButton". In the picture below, they are shown in the Arrows panel. Click on them once, and then once in shape, and they appear on it.</p><p>These are text fields for input and a regular button. You encounter these elements using almost any Windows program. Take a look.</p><p><img src='https://i0.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-27.jpg' width="100%" loading=lazy loading=lazy><br></p> <p>Now clean these inscriptions. Click the View tab. And click on the "Inspector of Objects. This window will appear.</p><p><img src='https://i1.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-28.jpg' width="100%" loading=lazy loading=lazy></p><p>Click once on our element "Button" on the form and change the value "Caption" in the inspector window to any other. For example, on the word "OK". Click Enter. We see on the form, as the element has changed the name.</p><p>Just do it with Edit, just do not rename, but we will make them without any content. We highlight them in turn and clean the TEXT value in the inspector. Do not forget to press ENTER.</p><p><img src='https://i2.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-29.jpg' width="100%" loading=lazy loading=lazy></p><p>According to the result, our form looks like this.</p><p><img src='https://i0.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-30.jpg' width="100%" loading=lazy loading=lazy><br></p> <p>Now that our calculator earned, you need to register the necessary software code for the procedure of our button. Click on the Button element twice and open the source editor.</p><p><img src='https://i2.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-31.jpg' width="100%" loading=lazy loading=lazy></p><p>See? Button1Click procedure. This is a procedure that is responsible for what happens when we click on the button once. And the following must occur: the program is needed in the third edit to bring us the sum of the numbers introduced in the first two fields. We write the code.</p><p><img src='https://i0.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-32.jpg' width="100%" loading=lazy loading=lazy></p><p>Such simple 5 lines of code we need to write. Comments and explanations are visible in the picture above. After that, click this button.</p> <p>A compilation of our project will be compiled. It will be assembled in the program. We enter the numbers in the first two fields, click on the button and get the value of the amount.</p><p><img src='https://i1.wp.com/reshatel.org/wp-content/uploads/2018/09/Bez-imeni-34-2.jpg' width="100%" loading=lazy loading=lazy></p> <h2>Conclusion</h2> <p>You can click the "File" button, then "Save everything", select the folder to save and you will have a full-fledged program, the start of which can be done from the desktop. Now try to figure it out on your own that you need to rewrite in this code so that the program shall be divided by two numbers, and not folded. Tip: You need to change the data type. The video below shows a similar example, but in Delphi 7, not Lazarus.</p><p><span class="6qR5tjJKK3g"></span></p> <p>Many Delphi programmers, Saving settings are associated using <i>INI.</i> Files in their programs. The use of this method, in less serious projects, it is necessary to avoid, as it limits in flexibility, which prevents further expansion of the program. It is worth saying that such an approach is quite popular, due to its ease of use and the presence of built-in funds on the development environment. <br><br> However, the ideal option for storing the program settings are structured <i>Xml</i> Files. Their advantage is that the number of parameters may not be fixed. To better understand this, consider a specific example.</p><p>In the USEarch program, when you click on recording, a context menu appears, which displays the list of points. These items are commands that in turn are downloaded from the settings file. In the event that the settings were stored in <i>INI.</i> The file, the program could save and load a certain number of commands, for example 10 or 50. As soon as you need more important, you will need to rewrite the code and, accordingly, re-compile it.</p><p><img src='https://i1.wp.com/zoo-mania.ru/wp-content/uploads/2011/08/settings.ini_.jpg' height="145" width="247" loading=lazy loading=lazy><br> Applying an approach using <i>Xml</i> Files, we will have the ability to download all the parameters of the section dynamically. To all this, the configuration file will become more elegant, without excessive numbering of parameters. However, standard tools for working with <i>Xml</i> Delphi has many drawbacks, so I recommend using the standard library <b>MSXML.</b>. Usually it is the default part of the Windows family systems.</p><p><img src='https://i1.wp.com/zoo-mania.ru/wp-content/uploads/2011/08/settings.xml_.jpg' align="center" width="100%" loading=lazy loading=lazy><br> For connecting <b>MSXML.</b>We need to form an interface file with a list of all functions by importing it from the COM server. How to import the interface is written not enough detailed articles, I suggest you download the file <b>MSXML2_TLB.PAS.</b> Already ready to use. After the file is downloaded, place it next to your project, or throw to the Delphi Lib LIB folder. Thus, all programs created will be able to use the module. <b>MSXML.</b>, It is enough to add msxml2_tlb to the USEs.</p><p>For clarity, consider the following example of the application of this library:</p><p>Procedure Loaddata; VAR XMLDOC: DomDocument; Root: ixmldomelement; Begin xmldoc: \u003d codomdocument.create; XMLDOC.LOAD ("settins.xml"); Root: \u003d xmldoc.documentElement; ShowMessage ("Size / Width"). Text); Root: \u003d nil; Xmldoc: \u003d nil; end;</p><p>First, an instance of the DomDocument class is created, after which the contents of the settings.xml file is loaded into the memory. As according to the standard any <i>Xml</i> The file must contain the root tag (in this case <i>config</i>), then we need to get it using the function <i>DocumentElement</i>. Then the contents of the content between tags <width></width> which in turn are between tags <size></size> . Thus, from the settings.xml file, our method will deploy text in MessageBox <i>"100px"</i>.</p><p> <?xml version="1.0" encoding="utf-8"?> <config> <size> <height>500px</height> <width>100px</width> </size> </config> </p><p>Here the SELECTSINGLENDE method is applied, which takes the string as a parameter.</p> <script>document.write("<img style='display:none;' src='//counter.yadro.ru/hit;artfast?t44.1;r"+ escape(document.referrer)+((typeof(screen)=="undefined")?"": ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth? screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+";h"+escape(document.title.substring(0,150))+ ";"+Math.random()+ "border='0' width='1' height='1' loading=lazy loading=lazy>");</script> </div> </article> <div class="post-bottom"> <div class="post-share"> <script src="//yastatic.net/es5-shims/0.0.2/es5-shims.min.js"></script> <script src="//yastatic.net/share2/share.js"></script> <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,moimir" data-counter=""></div> </div> </div> <div class='yarpp-related'> <div class="related-items"> <div class="headline">Did not find an answer to your question? Look at here</div> <div class="items"> <div class="related-item"> <a class="related-item__title" href="https://totrdlo.ru/en/registraciya-lichnoi-stranicy-v-socialnoi-seti-facebook-kak-obedinit-dve-uchetnye.html"><img src="/uploads/3283d29449f6fcf31e7b8c7f3a8f6779.jpg" width="120" height="120" alt="How to combine two accounts on Facebook?" class="related-item__image" / loading=lazy loading=lazy>How to combine two accounts on Facebook?</a> <div class="related-item__comments"><span></span></div> </div> <div class="related-item"> <a class="related-item__title" href="https://totrdlo.ru/en/kak-v-vorde-delat-ramki-krasivye-skachivaem-i-vstavlyaem-krasivye-ramki-v.html"><img src="/uploads/fd38b064f444ed23c0ccb9be68fc25ad.jpg" width="120" height="120" alt="Download and insert a beautiful framework to Word Document" class="related-item__image" / loading=lazy loading=lazy>Download and insert a beautiful framework to Word Document</a> <div class="related-item__comments"><span></span></div> </div> <div class="related-item"> <a class="related-item__title" href="https://totrdlo.ru/en/clock-watchdog-timeout-windows-10-chto-delat-kak-ispravit-oshibki-clock-watchdog-timeout-tipa-sinii.html"><img src="/uploads/418be8351eeee7a32bc2c905fc8ed975.jpg" width="120" height="120" alt="How to fix clock_watchdog_timeout type errors"синий экран" (0x00000101)" class="related-item__image" / loading=lazy loading=lazy>How to fix clock_watchdog_timeout type "Blue screen" (0x00000101)</a> <div class="related-item__comments"><span></span></div> </div> </div> </div> </div> <div style="text-align: center; margin-top: 15px; margin-bottom: 15px; " id="vanna-1965575812"><div class="adsense"><script type="text/javascript">ga_1();</script></div></div> </main> <aside class="sidebar"> <div class="advices" data-theme="vannapedia_v.3"> <div class="headline"></div> <div class="advices-content"> <img src="/uploads/e819878f778f58eec8fa5da1561c1952.jpg" width="120" height="120" alt="Intel Core i5 4590 Processor Reviews" class="advices__image" / loading=lazy loading=lazy> <div class="advices__title" data-id="3334"><a href="https://totrdlo.ru/en/processor-intel-core-i5-4590-otzyvy-obem-kesh-pamyati-l3-mb.html">Intel Core i5 4590 Processor Reviews</a></div> </div> </div> <div class="vk-widget" id="text-3"> <div class="textwidget"><script type="text/javascript" src="//vk.com/js/api/openapi.js?130"></script> <div id="vk_groups"></div> </div> </div> <div class="sidebar-questions"> <div class="headline">New</div> <ul> <li><a href="https://totrdlo.ru/en/chto-delat-esli-chernyi-ekran-chernyi-ekran-pri-vklyuchenii.html" >Black screen when you turn on the computer</a></li> <li><a href="https://totrdlo.ru/en/kak-zablokirovat-programme-dostup-v-internet-kak-zablokirovat.html" >How to block access programs on the Internet correctly?</a></li> <li><a href="https://totrdlo.ru/en/cherneet-ekran-chernyi-ekran-pri-vklyuchenii-kompyutera-chto.html" >Black screen when you turn on the computer?</a></li> <li><a href="https://totrdlo.ru/en/nastroika-mach3-pod-vash-stanok-bazovaya-nastroika-mach3-pereklyuchit-yazyk-na-match.html" >Basic Setup Mach3 Switch Language on Match 3</a></li> <li><a href="https://totrdlo.ru/en/pochemu-net-zvuka-v-dinamikah-kompyutera-pochemu-ne-rabotaet-zvuk-na.html" >Why the sound does not work on the computer how to fix the problem</a></li> <li><a href="https://totrdlo.ru/en/kak-nachertit-diagrammu-v-vorde-stroim-grafiki-i-diagrammy-v-ms-word-diagramma.html" >Build graphics and charts in MS Word</a></li> </ul> </div> <div class="section"> </div> <div class="section"> <div class="headline">Popular articles</div> <ul class="sidebar-posts"> <li><a href="https://totrdlo.ru/en/anime-fony-dlya-yandeks-brauzera-zhivye-upravlenie-temami-v-yandeks.html"><img src="/uploads/a7fbccd6efc443dd82be7ccfadade707.jpg" width="80" height="80" alt="Management of themes in Yandex" / loading=lazy loading=lazy>Management of themes in Yandex</a></li> <li><a href="https://totrdlo.ru/en/post-i-get-zaprosy-prostymi-slovami-kak-otpravit-post-zapros-iz-brauzera-metod.html"><img src="/uploads/b37483beedf1144b2ca10b1603f4d78c.jpg" width="80" height="80" alt="How to send POST Request Browser: Method Post Variable Post in PHP Use Examples" / loading=lazy loading=lazy>How to send POST Request Browser: Method Post Variable Post in PHP Use Examples</a></li> <li><a href="https://totrdlo.ru/en/kakie-sistemnye-trebovaniya-igry-cs-go-optimalnyi-komp-dlya.html"><img src="/uploads/ba7b6a9d8273cc696c1be7825f6e3e6c.jpg" width="80" height="80" alt="Optimal computer for COP which computer for CS GO" / loading=lazy loading=lazy>Optimal computer for COP which computer for CS GO</a></li> </ul> </div> <div class="section"> <div class="headline">New on the site</div> <ul class="sidebar-posts sidebar-photo"> <li><a href="https://totrdlo.ru/en/optimalnyi-komp-dlya-ks-go-kompyuter-dlya-cs-go-sistema-na-kotoroi-ks-go-ne.html">Optimal computer for COP</a></li> <li><a href="https://totrdlo.ru/en/ispolzovanie-xml-v-srede-delphi-ispolzovanie-xml-document-object-model-sozdanie-xml-v.html">Using XML Document Object Model Creating an XML in Delphi Xe Flap</a></li> <li><a href="https://totrdlo.ru/en/kak-ubrat-oshibku-scenariya-v-windows-kak-ispravlyat-svoi-oshibki.html">How to correct your mistakes how to fix all the laptop errors</a></li> <li><a href="https://totrdlo.ru/en/migaet-bukva-s-na-printere-ustranyaem-oshibki-esli-printer.html">Eliminate errors if the printer does not want to print</a></li> <li><a href="https://totrdlo.ru/en/kak-ubrat-oshibku-scenariya-v-windows-ispravlyaem-oshibki-v-rabote-windows-kak.html">Correct windows in Windows how to get rid of computer errors</a></li> </ul> </div> </aside> </div> <footer class="footer"> <nav class="footer__nav"><ul><li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-1219"><a href="https://totrdlo.ru/en/">New</a> <ul class="sub-menu"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/ustranenie-nepoladok-zablokirovannyh-ustanovok-i-udalenii-net.html">Troubleshooting locked installations and deletions</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/modul-chisla-v-eksele-summirovanie-po-modulyu-v-excel-alternativnye.html">Summation module in Excel</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/administrator-windows-zaproshennaya-operaciya-trebuet-povysheniya-administrator.html">The requested operation requires an increase</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/zakrepit-stroku-v-word-zakreplyaem-zakreplenie-paneli-instrumentov-v-word-vklyuchenie.html">Fastening the toolbar in Word</a></li> </ul> </li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-1230"><a href="https://totrdlo.ru/en/">Popular</a> <ul class="sub-menu"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/zakrepit-tablicu-v-word-zakreplenie-paneli-instrumentov-v-word-vklyuchenie-otdelnyh.html">Fastening the toolbar in Word</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/ne-udalyaetsya-stranica-v-word-kak-v-programme-word-udalyat-stranicy.html">As in Word program to delete pages</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/pochemu-poyavlyaetsya-sinii-ekran-na-windows-7-sinii-ekran-smerti-bsod-boremsya.html">Blue Death Screen (BSOD) - We struggle with errors</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/smenit-imya-vkontakte-bez-proverki-kak-pomenyat-imya-i-familiyu-v.html">How to change the name and surname to VK</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/vklyuchaetsya-noutbuk-acer-aspire-v3-571g-ne-vklyuchaetsya-noutbuk-acer-sbros.html">Not included laptop Acer</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/rabochaya-klaviatura-ne-rabotaet-ustanovka-draivera-s-diska-otkazyvaetsya.html">Installing Driver from Disk</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/moshchnye-igrovye-pk-moshchnye-igrovye-pk-kak-sobrat-igrovoi-komp-za-100000.html">Powerful gaming PCs How to assemble a gaming computer for 100,000</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/devil-may-cry-vyletaet-ne-zapuskaetsya-dmc-tormozit-igra-vyletaet-glyuchit-reshenie-samyh-rasprostra.html">Devil May Cry crashes. Doesn't DMC start? Inhibits the game? Crashes? Buggy? Resolving the most common problems. After each mission in DMC: Devil May Cry problems with the transfer of the account for lists of leaders</a></li> </ul> </li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-1236"><a href="https://totrdlo.ru/en/">Recommended</a> <ul class="sub-menu"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/dyablo-3-zavisaet-vo-vremya-igry-ne-zapuskaetsya-diablo-iii-tormozit-igra-vyletaet.html">Doesn't Diablo III start?</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/kak-proverit-kompyuter-na-sledyashchie-programmy-kak-proverit-kompyuter-na.html">How to check the computer to spyware</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/kak-naiti-programmu-slezheniya-na-kompyutere-shpionskie.html">Spyware on the computer</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/chto-delat-esli-mass-effect-3-vyletaet-pri-zapuske-mass-effect-ne-zapuskaetsya.html">Mass Effect does not start: problem solving</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/reshenie-samyh-rasprostranennyh-problem-ne-zapuskaetsya-the-saboteur.html">Does Saboteur start?</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/pochemu-kompyuter-shch-lkaet-prichiny-po-kotorym-shchelkaet-zhestkii.html">The reasons for which the hard disk clicks and their solution to do when clicking in the system unit</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/deadfall-adventures-kak-sdelat-polnoekrannyi-rezhim-kak-aktivirovat-polnoekrannyi-rezhim-v-brauzere.html">How to activate fullscreen mode in the browser?</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-"><a href="https://totrdlo.ru/en/mirror-s-edge-chernyi-ekran-zvuk-est-mirrors-edge-ne-zapuskaetsya-ne.html">Mirrors EDGE does not start, does not work, not installed</a></li> </ul> </li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-6898"><a href="https://totrdlo.ru/en/">About the site</a> <ul class="sub-menu"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-6900"><a href="">About the site</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-6901"><a href="">Advertising on the website</a></li> <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-6902"><a href="">Contacts</a></li> </ul> </li> </ul></nav> <div class="footer-bottom"> <div class="footer-left"> <div class="foot__logo"> <div class="footer__logo-sitename">totrdlo.ru. <span> Ru</span></div> </div> <style> .foot__logo { min-height: 35px; margin: 0 0 11px -79px; padding: 9px 0 0 79px; text-decoration: none; } </style> <p>© 2021 All rights reserved</p> <p>Your mobile guide. Operators. Useful advice</p> <ul class="footer-bottom__nav"> <li><a href="" >Advertising on the project</a></li> </ul> </div> <div class="footer-buttons"> </div> <ul class="footer__soc"> <li><a href="http://vk.com/" target="_blank" class="vk">In contact with</a></li> <li>Odnoklassniki.</li> <li><a href="http://www.facebook.com/" target="_blank" class="fb">Facebook.</a></li> <li><a href="https://twitter.com/" target="_blank" class="twi">Twitter.</a></li> </ul> <div class="footer-right"> <div class="footer__note"></div> <div class="footer__counters" id="text-2"> <div class="textwidget"></div> </div> </div> </div> </footer> </div> </div> <link rel='stylesheet' id='wp-lightbox-bank.css-css' href='/wp-content/plugins/wp-lightbox-bank/assets/css/wp-lightbox-bank.css?ver=4.8.3' type='text/css' media='all' /> <script type='text/javascript' src='https://totrdlo.ru/wp-content/themes/vannapedia_v.3/js/scripts.js'></script> <script type='text/javascript' src='/wp-includes/js/comment-reply.min.js?ver=4.8.3'></script> <script type='text/javascript' src='/assets/scripts1.js'></script> <script type='text/javascript'> /* <![CDATA[ */ var tocplus = { "smooth_scroll":"1"} ; /* ]]> */ </script> <script type='text/javascript' src='https://totrdlo.ru/wp-content/plugins/table-of-contents-plus/front.min.js?ver=1509'></script> <script type='text/javascript'> var q2w3_sidebar_options = new Array(); q2w3_sidebar_options[0] = { "sidebar" : "sidebar-fixed", "margin_top" : 10, "margin_bottom" : 0, "stop_id" : "respond", "screen_max_width" : 0, "screen_max_height" : 0, "width_inherit" : false, "refresh_interval" : 1500, "window_load_hook" : false, "disable_mo_api" : false, "widgets" : ['text-4'] } ; </script> <script type='text/javascript' src='https://totrdlo.ru/wp-content/plugins/q2w3-fixed-widget/js/q2w3-fixed-widget.min.js?ver=5.0.4'></script> <script type='text/javascript' src='/wp-includes/js/wp-embed.min.js?ver=4.8.3'></script> <script type='text/javascript' src='https://totrdlo.ru/wp-content/plugins/wp-lightbox-bank/assets/js/wp-lightbox-bank.js?ver=4.8.3'></script> <script type='text/javascript' src='https://totrdlo.ru/wp-content/plugins/akismet/_inc/form.js?ver=4.0'></script> </body> </html>