简体   繁体   English

如何在iPhone中将数据传递到Tbxml

[英]how to pass data to Tbxml in iphone

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. 我正在尝试使用TBXML,我想通过发送用户名和密码来解析xml,但是dnt如何做到这一点,我已经经历了很多教程。

  -(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];
                        }
                    }
                }

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 您可以通过以下链接设置您运行时的电子邮件和密码操作启动字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM