Introduction to Tree-Based XML Programming Guide for Cocoa
XML is a ubiquitous and flexible markup standard for processing and exchanging data. You can find XML in property lists, as the file format of various applications, and as the format of various sources of information on the Internet, including web-based services. The NSXML classes of Foundation give you a way to process this information efficiently. NSXML logically represents an XML document as a hierarchical tree structure and allows you to query this structure and manipulate its nodes. It supports several XML-related technologies and standards, such as XQuery, XPath, XInclude, XSLT, DTD, and XHTML.
This document explains how you can use NSXML effectively. You might find this information valuable if you need to create, modify, and repeatedly query XML documents. If you simply need to parse XML and extract information from an existing source of XML, the NSXMLParser class is more suited to your needs. For information on using the NSXMLParser class, which is the Cocoa interface to a streaming XML parser, see Event-Driven XML Programming Guide.
Organization of This Document
This document includes the following articles:
NSXML and XML Processing describes the features and capabilities of NSXML and suggests how you can use it in your applications.
The Data Model of NSXML describes the XQuery-derived data model on which NSXML is based.
Creating an XML Document Object explains how to process input sources of XML, how to create an XML document programmatically, and how to transform an existing XML tree structure using XSLT.
Writing XML From NSXML Objects describes how to request an XML document, or a branch of a document, to emit its represented content as XML markup text.
Traversing an XML Tree explains how to use NSXML programmatic interfaces to move around within an XML tree structure.
Querying an XML Document explains how to use the methods that allow you to perform XQuery and XPath queries to locate particular nodes and objects in an XML tree structure.
Modifying an XML Document describes how to add, remove, and replace nodes in an XML tree and now to change the values of nodes.
Representing Object Values as Strings describes the string representations for the standard atomic types and explains how you can obtain string representations of custom objects used as node values.
Handling Attributes and Namespaces discusses how to use the methods that are specific to attribute nodes and namespace nodes.
Binding NSXML Objects to a User Interface examines a sample NSXML application to illustrate how you can establish bindings between NSXML objects and a user interface.
Using Tree Controllers With NSXML Objects shows how you can establish bindings between an NSXML document, an
NSTreeController
object, and anNSOutlineView
object.
A XML Glossary of XML terms is also included.
See Also
Many sources of information on XML and related standards and technologies are available on the Internet, including the following documents from the World Wide Web Consortium (W3C) website:
“XQuery 1.0 and XPath 2.0 Data Model”—http://www.w3.org/TR/xpath-datamodel/
“XMLSchema Part 1: Structures”—http://www.w3.org/TR/xmlschema-1/
“XML Schema Part 2: Datatypes —http://www.w3.org/TR/xmlschema-2/
“XML Query Use Cases”—http://www.w3.org/TR/xquery-use-cases/
“XML Path Language (XPath) 2.0”—http://www.w3.org/TR/xpath20/
“DOM Object Model Core”—http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/core.html
The following are useful websites on XML:
The Annotated XML Specification—http://www.xml.com/axml/testaxml.htm
O’Reilly XML.com—http://www.xml.com/
Several XQuery tutorials are listed at the end of Querying an XML Document underResources For Learning XQuery.
Copyright © 2004, 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-09-18