ElementToPropertyMapping in RestKit

I am learning RestKit. I came across the elementToPropertyMapping function that it provides. I am wondering if I can use this mapping for XML documents? or is it just for json?

In the tutorial, I found that they provide a JSON channel. Therefore, I am confused. Also is there any other XML parser for iOS that provides this mapping function. Thanks

+3
source share
3 answers

The tutorial you found is out of date. elementToPropertyMappings is no longer used. Instead of inheriting from RKObject or RKManagedObject, you use the usual objective-c classes and map data with them using RKObjectMapping.

.

, RestKit XML. mimetype xml json; , , xml .

+5

, gitHub , , XML RestKit, , , .

, XML:

, :

<?xml version="1.0" encoding="UTF-8"?>
<users type="array">
    <user>
        <id>1</id>
        <name>Roberto</name>
        <company>Apple</company>
    </user>
    <user>
        <id>2</id>
        <name>Carlos</name>
        <company>Adobe</company>
     </user>
</users>

Objective-C, keyPath, : "users" <-first tag "user" < "", .

:

[[RKObjectManager sharedManager].mappingProvider setMapping:objectMapping forKeyPath:@"users.user"];

, ( ):

https://github.com/RestKit/RestKit/wiki/Object-mapping

+2

xml parser iOS

, RestKit. , xml. , RestKit .

xml Restkit . / , , RestKit API. RKXMLParserLibXML.

0

All Articles