Altova Mailing List Archives>Archive Index >xml-dev Archive Home >Recent entries >Thread Prev - RE: [xml-dev] XML Schema: "Best used with the ______ tool" >Thread Next - RE: [xml-dev] XML Schema: "Best used with the ______ tool" Re: [xml-dev] XML Schema: "Best used with the ______ tool"To: Michael Kay <mike@--------.---> Date: 11/28/2008 1:20:00 PM Hi Michael, Michael Kay <mike@s...> writes: > [...] I don't think there's any intrinsic reason why they should > be slower than data binding. I'm not saying they are faster, just > challenging your assertion that they are impossibly slow - I think > the burden of proof is on you. On the high level, the primary reason is that with data binding the operations are performed on the data itself while XSLT, XQuery, etc., operate on the XML representation of this data. On a more technical level, I believe the two primary areas that contribute to the performance difference are the string-based flow control (XSTL/XQuery compare strings to access an element while data binding simply calls an (inline) function) as well as conversion of data to/from string representation. As an example, consider the following XML fragment: <people> <person name="John Doe", age="32"/> <person name="Jane Doe", age="28"/> ... </people> Let's say we want to access all people younger than 30. With data binding we will have something like this: people p = ... for (iterator i = p.begin (); i != p.end (); ++i) { if (i->age () < 30) { // process } } The age value is retrieved using a function call and the return value is of type int, directly comparable to 30. With XML representation there will be a bunch of string comparisons to first locate all "person" elements and then to locate the "age" attribute. We will also need to convert the age value from string to int in order to compare it. Boris -- Boris Kolpackov, Code Synthesis Tools http://codesynthesis.com/~boris/blog Open source XML data binding for C++: http://codesynthesis.com/products/xsd Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde _______________________________________________________________________ XML-DEV is a publicly archived, unmoderated list hosted by OASIS to support XML implementation and development. To minimize spam in the archives, you must subscribe before posting. [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ Or unsubscribe: xml-dev-unsubscribe@l... subscribe: xml-dev-subscribe@l... List archive: http://lists.xml.org/archives/xml-dev/ List Guidelines: http://www.oasis-open.org/maillists/guidelines.php | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
