]> err.no Git - sope/blob - sope-xml/DOM/README
fixed some comments
[sope] / sope-xml / DOM / README
1 How to build a DOM tree ?
2 =========================
3
4 1. get a factory
5
6   DOMBuilderFactory *factory
7     = [DOMBuilderFactory standardDOMBuilderFactory];
8
9 2. get a builder for your resource type
10
11   id<DOMBuilder> builder
12     = [factory createDOMBuilderForMimeType:@"text/xml"];
13
14 3. parse what you have:
15
16   id<DOMDocument> document
17     = [builder buildFromSource:@"myfile.xml"];
18
19
20 KVC
21 ===
22
23 You can navigate the DOM tree with standard key/value coding. The NGDOMDocument
24 will treat all KVC keys starting with a "/" as query path expressions.
25
26 Samples:
27   document.documentElement             => root DOMElement
28   document.documentElement.childNodes  => NSArray containing the root children
29   document./uid                        => DOMElement or array! matching 'uid'
30   document./uid.textValue              => text-value of 'uid' element
31
32   element.@value.textValue    => text-value of 'value' attribute of element
33   element./subnode.textValue  => lookup subnode (strips of the /) using QP
34
35
36 Some info on classes ...
37 ========================
38
39 Nodes with children
40
41   Document
42   DocumentFragment
43   EntityReference
44   Element
45   Attr
46   Entity
47
48 Nodes without children
49
50   DocumentType
51   ProcessingInstruction
52   Comment
53   Text
54   CDATASection
55   Notation
56
57 Nodes with parent
58
59   DocumentType
60   EntityReference
61   Element
62   ProcessingInstruction
63   Comment
64   Text
65   CDATASection
66
67 Nodes without parent
68
69   Document
70   DocumentFragment
71   Attr
72   Entity
73   Notation