Once the wizard has generated a set of interfaces and implementation classes, you can use them to work with XML documents that match the structure of the document or schema you supplied to the wizard. Just as when you are using only the built-in XML components, your starting point is the TXMLDocument component that appears on the Internet category of the Tool Palette.
Method |
Description |
Place a TXMLDocument component in your form or data module. Bind the TXMLDocument to an XML document by setting the FileName property. |
(As an alternative approach, you can use a string of XML by setting the XML property at runtime.) Then, In your code, call the global function that the wizard created to obtain an interface for the root node of the XML document. For example, if the root element of the XML document was the tag <StockList>, by default, the wizard generates a function Getstocklist, which returns an IXMLStockListType. interface: var StockList: IXMLStockListType; begin XMLDocument1.FileName := 'Stocks.xml'; StockList := Getstocklist(XMLDocument1); XMLDocument1->FileName := "Stocks.xml"; _di_IStockListType StockList = GetStockListType(XMLDocument1); |
Call the generated Load... function |
Call the generated Load... function to create and bind the TXMLDocument instance and obtain its interface all in one step. For example, using the same XML document described above: var StockList: IXMLStockListType; begin StockList := Loadstocklist('Stocks.xml'); _di_IStockListType StockList = LoadStockListType("Stocks.xml"); |
Call the generated New... function |
Call the generated New... function to create the TXMLDocument instance for an empty document when you want to create all the data in your application: var StockList: IXMLStockListType; begin StockList := Newstocklist; _di_IStockListType StockList = NewStockListType(); |
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|