Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // NSXMLParser
- - (void) tratarXMLTest: (NSString *) xml
- {
- NSData* xmlData = [[NSData alloc] initWithData:[xml dataUsingEncoding:NSUTF8StringEncoding]];
- NSXMLParser *XMLReader = [[NSXMLParser alloc] initWithData: xmlData];
- [XMLReader setDelegate: self];
- [XMLReader parse];
- NSLog(@"Número de líneas %d - Número de columnas %d - System id %@", [XMLReader lineNumber],[XMLReader columnNumber], [XMLReader systemID]);
- [XMLReader abortParsing];
- }
- - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict
- {
- NSLog(@"didStartElement: %@", elementName);
- NSLog(@"namespaceURI: %@", namespaceURI);
- NSLog(@"qualifiedName: %@", qualifiedName);
- NSLog(@"attributes: %@", attributeDict);
- }
- // XML File
- <object>
- <piloto>
- <id>1</id>
- <alias>juan</alias>
- <email>jps@solu.pro</email>
- <fechaAlta>2013-02-19 16:23:33</fechaAlta>
- <nombre>Juan</nombre>
- <apellido1>Prada</apellido1>
- <apellido2></apellido2>
- <tlf_fijo>928112233</tlf_fijo>
- <tlf_movil>6667788899</tlf_movil>
- <facebook></facebook>
- </piloto>
- </object>
- // NSLog prompted
- 2013-02-25 10:33:36.742 GeoRuta[1624:907] didStartElement: object
- 2013-02-25 10:33:36.743 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.744 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.745 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.746 GeoRuta[1624:907] didStartElement: piloto
- 2013-02-25 10:33:36.746 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.747 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.748 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.749 GeoRuta[1624:907] didStartElement: id
- 2013-02-25 10:33:36.750 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.751 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.751 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.752 GeoRuta[1624:907] didStartElement: alias
- 2013-02-25 10:33:36.753 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.754 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.755 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.756 GeoRuta[1624:907] didStartElement: email
- 2013-02-25 10:33:36.757 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.757 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.758 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.759 GeoRuta[1624:907] didStartElement: fechaAlta
- 2013-02-25 10:33:36.760 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.761 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.762 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.763 GeoRuta[1624:907] didStartElement: nombre
- 2013-02-25 10:33:36.763 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.764 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.765 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.766 GeoRuta[1624:907] didStartElement: apellido1
- 2013-02-25 10:33:36.767 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.768 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.768 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.769 GeoRuta[1624:907] didStartElement: apellido2
- 2013-02-25 10:33:36.770 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.771 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.772 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.773 GeoRuta[1624:907] didStartElement: tlf_fijo
- 2013-02-25 10:33:36.773 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.774 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.775 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.776 GeoRuta[1624:907] didStartElement: tlf_movil
- 2013-02-25 10:33:36.777 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.778 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.778 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.779 GeoRuta[1624:907] didStartElement: facebook
- 2013-02-25 10:33:36.780 GeoRuta[1624:907] namespaceURI: (null)
- 2013-02-25 10:33:36.781 GeoRuta[1624:907] qualifiedName: (null)
- 2013-02-25 10:33:36.782 GeoRuta[1624:907] attributes: {
- }
- 2013-02-25 10:33:36.783 GeoRuta[1624:907] Número de líneas 14 - Número de columnas 10 - System id (null)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement