xml parser
| Thu, 2008-07-24 07:29 | |
|
Hi All, <?xml version="1.0" ?> Eg: if i am searching for the no 98451, and on successfull search, it should display only "AIRTEL","Karnataka". but i am getting all the data in the file. Thanks in advance |
|






Forum posts: 88
Hi veekay
Sorry I couldn't completely understand you ,
Any way
These are some step for getting AIRTEL and Karnataka from your XML file: First Read complete data in Descriptor
1-> Search for 98451( you are successful as you mentioned above )
2->Search for
3->Search for
follow above three step :
If you encounter any problem , post that here
Thanks and Regard
Praveen Kumar Sharma
Forum posts: 15
Thanks Praveen, But how to get the value between the tag.
like in the xml parser example... what shud be written in the function
OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
and
OnContentL( const TDesC8 &aBytes, TInt aErrorCode )
i am sorry if i am asking the very basics.
thanks
Forum posts: 88
hi veekay
Sorry I haven't used Xml parser class now till but I have some good link by which you can sort out your problem
http://wiki.forum.nokia.com/index.php/How_to_parse_XML_file_using_CParser_class
http://discussion.forum.nokia.com/forum/showthread.php?t=119482
http://blogs.forum.nokia.com/index.php?op=ViewArticle&blogId=1412&articleId=475
http://blogs.forum.nokia.com/index.php?op=ViewArticle&blogId=34687&articleId=483
Thanks and Regard
Praveen Kumar Sharma
Forum posts: 15
Thanks praveen, My code is working now
Forum posts: 88
Hi veekay
Can you please explain where was you wrong in your code and what you did to make it workable
Thanks and Regard
Praveen Kumar Sharma
Forum posts: 15
I made changes in OnContentL( const TDesC8 &aBytes, TInt aErrorCode )
i included few line
if(buffer->Find(_L("98452"))!=KErrNotFound )
{
aFlag = KNumberFound;
}
if(aFlag == KFetchInfo)
{
if(iNumOfDataToFetch<4)
{
AppendText( *buffer );
iNumOfDataToFetch++;
}
}
and in
OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode )
i included
if(aFlag == KNumberFound)
{
aFlag = KFetchInfo;
}
thats all
Forum posts: 88
Thanks veekay
We all should complete the thread with solution , because the solution might be useful for others
Thanks and Regard
Praveen Kumar Sharma