[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] getElementsByName is available?
- From: kalyanasundaram <s kalyanasundaram gmail com>
- To: Stefan Behnel <stefan_ml behnel de>
- Cc: xml gnome org
- Subject: Re: [xml] getElementsByName is available?
- Date: Thu, 28 Jun 2007 14:17:04 +0530
On Thu, 2007-06-28 at 09:10 +0200, Stefan Behnel wrote:
>
> kalyanasundaram s wrote:
> > I need to parse a huge xml file for a specific set of nodes. Is there
> > any method like getElementByName is available in libxml. I could not
> > find it in the document. Does it exists with some other name?
> > Otherwise i will have to travel in the entire tree. It is inefficient.
>
> No it's not. It just depends on the implementation of getElementByName. :)
>
> You can always use XPath to find the tag. However, if your XML tree is really
> so big (note that XPath is pretty fast, so I'd try it first) you may consider
> building an index of the tree, i.e. some kind of data structure that maps tag
> names to a list of node pointers.
>
> Note that there is also a hash map implementation in libxml2, see hash.c.
>
> Stefan
Thanks for your information. I need to parse the xml file only once.
So which would be better? XPath or linear traversing?
I dont know much about XPath implementation. (Do they not traverse
atleast once?) The file size is about 500 KB. :)
So what do u suggest?
Thanks,
-"kalyan"
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]