ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
XML itself doesn't care anything about the data except that it's formatted correctly. This sort of concern would be defined by the schema of your particular flavor of XML.
XML itself doesn't care anything about the data except that it's formatted correctly. This sort of concern would be defined by the schema of your particular flavor of XML.
Well this is the problem. It's a huge xml file. To speed it up, once I find a particular parent node, to take just the information I want, I skip the parser a number of times so I get to the child node(s) I want in a particular parent node. This speeds it up immensely, however, the code isn't very nice, specially if in the future, the order is changed.
If I have a series of if statements to check every child node for what I want, it slows down.
I think relying on the order would be a Bad Idea. Unless something about the inherent nature of the data implies an order (ie, a list of dates).
Quote:
Originally Posted by vxc69
To speed it up, once I find a particular parent node, to take just the information I want, I skip the parser a number of times so I get to the child node(s) I want in a particular parent node.
Hmmm.. not sure I understand exactly what you're dealing with here. But it sounds like you have a parent node that has multiple child nodes of the same type? And which child node you need changes?
Any chance of getting a snippet of your XML that demonstrates this?
Also, what language are you parsing this in?
Quote:
Originally Posted by vxc69
Performance or Reliability?
I say reliability. Performance isn't worth much if it doesn't work.
I haven't fully followed this thread but just wanted to make a few comments.
If you want to enforce the structure, content, ordering, etc, of an XML document, the only way to do it is to use, as tuxdev said, schemas. Especially if the ordering of elements, etc, are very important, that should be more evidence that reliability has higher priority than performance. The cornerstone of good software is quality. You could have a program that sometimes doesn't work, but doesn't work very fast. Alternatively, you could have a program that always works, but the amount of time it takes may be unpredictable or untimely.
This could be compared to TCP vs UDP, in networking, where TCP is reliable with more overhead, and UDP is less reliable with less overhead. Each has their own application. You probably wouldn't prefer to use TCP to listen to streaming music. Also, you probably wouldn't prefer to use UDP in some critical web service API.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.