1. Trang chủ
  2. » Công Nghệ Thông Tin

delphi - delphi developer’s guide to xml

545 411 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 545
Dung lượng 13,6 MB

Nội dung

TEAMFLY Team-Fly ® Delphi Developer’s Guide to XML Keith Wood Wordware Publishing, Inc. Library of Congress Cataloging-in-Publication Data Wood, Keith, 1961- Delphi developer’s guide to XML / by Keith Wood. p. cm. Includes index. ISBN 1-55622-812-0 (pbk.) 1. XML (Document markup language). 2. Delphi (Computer file). 3. Computer software Development. I. Title. QA76.76.H94 W67 2001 005.7'2 dc21 2001026660 CIP © 2001, Wordware Publishing, Inc. All Rights Reserved 2320 Los Rios Boulevard Plano, Texas 75074 No part of this book may be reproduced in any form or by any means without permission in writing from Wordware Publishing, Inc. Printed in the United States of America ISBN 1-55622-812-0 10987654321 0107 Delphi is a registered trademark of Borland Software Corporation in the United States and other countries. Other products mentioned are used for identification purposes only and may be trademarks of their respective companies. All inquiries for volume purchases of this book should be addressed to Wordware Publishing, Inc., at the above address. Telephone inquiries may be made by calling: (972) 423-0090 ii Contents Dedication xi Preface xii Acknowledgments xiv Part I: Introduction to XML Chapter 1: History 3 XML vs. HTML 4 Related Specifications 5 Extensible Hypertext Markup Language (XHTML) 6 Mathematical Markup Language (MathML) 8 Scalable Vector Graphics (SVG) 10 Synchronized Multimedia Integration Language (SMIL) 13 Resource Description Framework (RDF) 15 References 19 Sample XML 21 Chapter 2: XML Syntax 22 Elements and Attributes 23 Name Tokens and Namespaces 24 Text and White Space 25 Comments 26 Processing Instructions 26 Entities 26 CDATA Sections 28 Prolog 29 Encoding Schemes 29 XML Processors 31 Summary 32 Chapter 3: Document Type Definitions 33 DTD Declarations 35 Content Model 36 Attributes 37 Notations 39 Entities 39 Summary 41 iii Chapter 4: Extensible Stylesheet Language Transformations 42 Transformations 42 Templates and Patterns 43 Text Content 45 Building Document Structure 45 Loops 46 Conditional Processing 47 XSLT Sample 48 Summary 51 Chapter 5: XLink 52 Link Definitions 52 Simple Links 54 Extended Links 55 Out-of-Line Links 57 Summary 57 Chapter 6: XPath and XPointer 58 General Form 58 Axes 59 Predicates 60 Locations 61 Functions 61 Abbreviated Syntax 63 Samples 64 Summary 65 Chapter 7: XML Schema 66 Schema Document 67 Documentation 68 Simple Types 68 Complex Types 69 Attribute Declarations 71 Element Declarations 72 Further Abilities of Schemas 73 Summary 74 Part II: The Document Object Model Chapter 8: The Document Object Model (DOM) 77 DOM Interfaces 77 DOMException 81 Node Interface 82 NodeList Interface 87 NamedNodeMap Interface 87 Element Interface 89 Attr Interface 91 Contents iv CharacterData Interface 92 Text Interface 93 CDATASection Interface 94 Comment Interface 94 ProcessingInstruction Interface 94 DocumentType Interface 95 Entity Interface 96 EntityReference Interface 97 Notation Interface 97 DocumentFragment Interface 98 Document Interface 98 DOMImplementation Interface 101 NodeFilter Interface 102 NodeIterator Interface 103 TreeWalker Interface 104 DocumentTraversal Interface 106 Summary 107 Chapter 9: Microsoft’s Document Object Model 108 IXMLDOMParseError Interface 110 IXMLDOMNode Interface 111 IXMLDOMNodeList Interface 119 IXMLDOMNamedNodeMap Interface 120 IXMLDOMElement Interface 122 IXMLDOMAttribute Interface 124 IXMLDOMCharacterData Interface 125 IXMLDOMText Interface 127 IXMLDOMCDATASection Interface 127 IXMLDOMComment Interface 128 IXMLDOMProcessingInstruction Interface 128 IXMLDOMDocumentType Interface 129 IXMLDOMEntity Interface 130 IXMLDOMEntityReference Interface 131 IXMLDOMNotation Interface 132 IXMLDOMDocumentFragment Interface 132 IXMLDOMDocument Interface 133 IXMLDOMDocument2 Interface 139 IXMLDOMSchemaCollection Interface 140 IXMLDOMSelection Interface 141 IXMLDOMImplementation Interface 143 Document Traversal 143 IXSLTemplate Interface 144 IXSLProcessor Interface 145 Loading the DOM 147 Contents v The MS DOM XML Viewer 149 Viewing Node Details 153 Threading the DOM 155 Summary 155 Chapter 10: CUESoft’s Document Object Model 157 TDOMException Exception 158 TXmlParserError Exception 159 TXmlNode Class 160 TXmlNodeList Class 165 TXmlNamedNodeMap Class 167 TXmlElement Class 169 TXmlAttribute Class 172 TXmlCharacterData Class 172 TXmlText Class 173 TXmlCDataSection Class 174 TXmlComment Class 174 TXmlProcessingInstruction Class 175 TXmlDocumentType Class 175 TXmlEntity Class 176 TXmlEntityReference Class 177 TXmlNotation Class 177 TXmlDocumentFragment Class 178 TXmlDocument Class 179 TXmlDomImplementation Class 181 TXmlObjModel Component 182 TXmlParser Component 185 Loading the CUESoft DOM 189 Summary 194 Chapter 11: Open XML’s Document Object Model 195 EDomException Exception 195 TdomNode Class 198 TdomNodeList Class 205 TdomNamedNodeMap Class 206 TdomElement Class 208 TdomAttr Class 211 TdomCharacterData Class 213 TdomText Class 214 TdomCDATASection Class 215 TdomComment Class 215 TdomProcessingInstruction Class 216 TdomDocumentType Class 216 TdomInternalSubset Class 219 TdomExternalSubset Class 219 Contents vi TdomConditionalSection Class 220 TdomEntity Class 221 TdomEntityDeclaration Class 223 TdomEntityReference Class 224 TdomNotation Class 225 TdomNotationDeclaration Class 226 TdomElementTypeDeclaration Class 227 Content Models 228 TdomAttrList Class 230 TdomAttrDefinition Class 231 TdomNametoken Class 232 TdomXmlDeclaration Class 233 TdomTextDeclaration Class 234 TdomDocumentFragment Class 234 TdomDocument Class 235 TdomImplementation Class 244 TdomNodeFilter Class 247 TdomNodeIterator Class 248 TdomTreeWalker Class 250 TXmlToDomParser Class 252 Helper Functions 256 Viewing with the Open XML DOM 261 Summary 268 Part III: Simple API for XML Chapter 12: Simple API for XML (SAX) 271 Working with SAX 271 SAX Elements 272 SAXException Class 275 SAXParseException Class 276 InputSource Class 277 Locator Interface 279 Attributes Interface 280 ContentHandler Interface 282 DTDHandler Interface 284 EntityResolver Interface 285 ErrorHandler Interface 285 SAX Extensions 286 LexicalHandler Interface 287 DeclHandler Interface 289 XMLReader Interface 290 XMLFilter Interface 291 ParserAdapter and XMLReaderAdapter Classes 292 Contents vii XMLReaderFactory Class 293 DefaultHandler Class 293 Summary 294 Chapter 13: Microsoft’s SAX Parser 295 IVBSAXLocator Interface 295 IVBSAXAttributes Interface 296 IVBSAXContentHandler Interface 298 IVBSAXDTDHandler Interface 301 IVBSAXEntityResolver Interface 302 IVBSAXErrorHandler Interface 302 IVBSAXLexicalHandler Interface 303 IVBSAXDeclHandler Interface 305 IVBSAXXMLReader Interface 306 IVBSAXXMLFilter Interface 309 Preparing for SAX Events 309 Responding to the Notifications 314 Summary 316 Chapter 14: SAX in Delphi 317 Conversion to Delphi 317 ESAXException Class 319 ESAXParseException Class 320 TSAXInputSource Class 321 ISAXLocator Interface 322 ISAXAttributes Interface 323 ISAXContentHandler Interface 326 ISAXDTDHandler Interface 328 ISAXEntityResolver Interface 329 ISAXErrorHandler Interface 330 SAX Extensions 330 ISAXLexicalHandler Interface 331 ISAXDeclHandler Interface 333 ISAXXMLReader Interface 334 ISAXXMLFilter Interface 336 TSAXParserAdapter and TSAXXMLReaderAdapter Classes 336 TSAXXMLReaderFactory Class 338 TSAXDefaultHandler Class 340 Building a SAX Reader 341 The SAX XML Viewer 345 Implementing ISAXContentHandler 349 Summary 353 Contents viii Chapter 15: Wrapping External Parsers 354 Adapting Microsoft’s SAX Parser 354 Using CUESoft’s Parser 359 Using Open XML’s Parser 362 Summary 362 Part IV: Serving XML Chapter 16: XML is Data 367 Movie-watcher Database 368 Chapter 17: Simple Text 370 From a Database 370 Summary 375 Chapter 18: Web Modules 376 Generation 377 TRecordPageProducer 381 Summary 385 Chapter 19: Document Object Model 386 Microsoft’s DOM 386 CUESoft’s DOM 391 Open XML’s DOM 392 Summary 396 Chapter 20: SAX Generation 397 IMXWriter Interface 397 IMXAttributes Interface 399 Creating a Writer 401 Defining the DTD 403 Adding Content 404 Summary 406 Chapter 21: Applying XSL Transformations 407 XSLT Utility 408 Transforming the Document 410 Monolithic HTML Transformation 411 Template-Based HTML Transformation 413 Comma-Separated Transformation 416 Rich Text Transformation 418 Summary 420 Chapter 22: XML Broker 422 The Data Server 423 InternetExpress 425 The CGI Web Application 426 Using ISAPI 430 XML Usage 430 Summary 434 Contents ix [...]... system-language="nl" system-overdub-or-caption="overdub"/> Part I: Introduction to XML Chapter 1: History... language-specific subtitles are available if desired Listing 1-6 : A SMIL movie presentation George Lucas ... did 18 Part I: Introduction to XML Listing 1-1 1: An RDF statement about a statement < ?xml version="1.0"?> George Lucas Keith Wood ... Specification http://www.w3.org/TR/xptr XML Schema Specification http://www.w3.org/TR/xmlschema-0 Document Object Model http://www.w3.org/DOM Simple API for XML http://www.megginson.com/SAX/ XML. com—a clearinghouse for XML- related items http://www .xml. com XML Software—another clearinghouse for XML http://www.xmlsoftware.com Robin Cover’s XML pages at OASIS http://www.oasis-open.org/cover/ XHTML Specification... with SGML 4 It shall be easy to write programs which process XML documents 5 The number of optional features in XML is to be kept to the absolute minimum, ideally zero 6 XML documents should be human-legible and reasonably clear 7 The XML design should be prepared quickly 8 The design of XML shall be formal and concise 9 XML documents shall be easy to create 10 Terseness in XML markup is of minimal importance... attribute to indicate that the statement applies to each item within a collection individually, as if a separate statement had been made for each one For example, to show that George Lucas produced each of the Star Wars movies, you could use the document from Listing 1-1 0 Listing 1-1 0: An statement about a collection < ?xml version="1.0"?> ... represents the XML document First we discuss Microsoft’s DOM as encapsulated in the MSXML v3 library and available to Delphi as COM objects Next we look at two packages written in Delphi: one from CUESoft and another from the Open XML project Part III describes an alternate approach to working with XML: the Simple API for XML (SAX) SAX uses an event-based mechanism for parsing the contents of an XML document,... zero to one Listing 1-1 2: RDF schema example ... version="1.0"?> Frequently, you need to refer to a collection of items within a statement, such as all the documents in a particular site, or a number of people who co-authored a document For these . Team-Fly ® Delphi Developer’s Guide to XML Keith Wood Wordware Publishing, Inc. Library of Congress Cataloging-in-Publication Data Wood, Keith, 196 1- Delphi developer’s guide to XML / by. Class 160 TXmlNodeList Class 165 TXmlNamedNodeMap Class 167 TXmlElement Class 169 TXmlAttribute Class 172 TXmlCharacterData Class 172 TXmlText Class 173 TXmlCDataSection Class 174 TXmlComment. 111 IXMLDOMNodeList Interface 119 IXMLDOMNamedNodeMap Interface 120 IXMLDOMElement Interface 122 IXMLDOMAttribute Interface 124 IXMLDOMCharacterData Interface 125 IXMLDOMText Interface 127 IXMLDOMCDATASection

Ngày đăng: 16/04/2014, 11:13

TỪ KHÓA LIÊN QUAN