Question

i am trying to use TBXML, i want to parse xml by sending username and password but dnt how to do it, i have already gone through many tutorials.

  -(IBAction)login{
                    NSString *str2=emailtxt.text;
                    NSString *str3=passtxt.text;

                    TBXML * tbxml = [TBXML tbxmlWithURL:[NSURL URLWithString:@"http://www.vinipost.com/my_service.asmx/signIn"]];


                    TBXMLElement *rootXMLElement = tbxml.rootXMLElement;

                    if (rootXMLElement)
                    {
                        TBXMLElement * user = [TBXML childElementNamed:@"Table1" parentElement:rootXMLElement];

                        while (user != nil)
                        {

                            TBXMLElement *CountryId = [TBXML childElementNamed:@"usrid" parentElement:user];
                            if (CountryId != nil)
                            {
                                NSLog(@"CountryId :: %@", [TBXML textForElement:CountryId]);
                            }

                            TBXMLElement *CountryName = [TBXML childElementNamed:@"ContctNmbr" parentElement:user];
                            if (CountryName != nil)
                            {
                                NSLog(@"CountryName :: %@", [TBXML textForElement:CountryName]);
                            }

                            user = [TBXML nextSiblingNamed:@"Table1" searchFromElement:user];
                        }
                    }
                }
Était-ce utile?

La solution

Change your URL to

[NSURL URLWithString:@"http://www.vinipost.com/my_service.asmx/signIn?email=yourEmail&pass=yourPass"];

You can set your email and password on runtime by following this link Operation On String

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top