added document
This commit is contained in:
parent
d483543ce2
commit
584d461515
10
README.md
10
README.md
|
@ -226,12 +226,12 @@ entity.names ?<< xml.ResultSet.Result.Hit[1].Name.text // assign if it has text
|
|||
```swift
|
||||
let numberOfHits = xml.ResultSet.Result.Hit.all?.count
|
||||
```
|
||||
### Check error
|
||||
### 8. Check error
|
||||
```swift
|
||||
print(xml.ResultSet.Result.TypoKey) // -> "TypoKey not found."
|
||||
```
|
||||
|
||||
### Access as SequenceType
|
||||
### 9. Access as SequenceType
|
||||
+ for-in
|
||||
```swift
|
||||
for element in xml.ResultSet.Result.Hit {
|
||||
|
@ -243,6 +243,12 @@ for element in xml.ResultSet.Result.Hit {
|
|||
xml.ResultSet.Result.Hit.map { $0.Name.text }
|
||||
```
|
||||
|
||||
### 9. Generate XML document
|
||||
```swift
|
||||
print(Converter(xml.ResultSet).makeDocument())
|
||||
```
|
||||
|
||||
|
||||
## Work with Alamofire
|
||||
SwiftyXMLParser goes well with [Alamofire](https://github.com/Alamofire/Alamofire). You can parse the response easily.
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ extension XML {
|
|||
|
||||
```
|
||||
let xml = try! XML.parse("<?xml version="1.0" encoding="UTF-8"?><doc><name key="value">text</name></doc>")
|
||||
let elem = xml["doc"]
|
||||
let elem = xml.doc
|
||||
|
||||
print(Converter(elem).makeDocument())
|
||||
// => <?xml version="1.0" encoding="UTF-8"?><name key="value">text</name>
|
||||
|
|
Loading…
Reference in New Issue