OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 EvaluationContext& evaluationContext = Expression::evaluationContext(); | 66 EvaluationContext& evaluationContext = Expression::evaluationContext(); |
67 evaluationContext.node = contextNode; | 67 evaluationContext.node = contextNode; |
68 evaluationContext.size = 1; | 68 evaluationContext.size = 1; |
69 evaluationContext.position = 1; | 69 evaluationContext.position = 1; |
70 evaluationContext.hadTypeConversionError = false; | 70 evaluationContext.hadTypeConversionError = false; |
71 RefPtr<XPathResult> result = XPathResult::create(contextNode->document(), m_
topExpression->evaluate()); | 71 RefPtr<XPathResult> result = XPathResult::create(contextNode->document(), m_
topExpression->evaluate()); |
72 evaluationContext.node = 0; // Do not hold a reference to the context node,
as this may prevent the whole document from being destroyed in time. | 72 evaluationContext.node = 0; // Do not hold a reference to the context node,
as this may prevent the whole document from being destroyed in time. |
73 | 73 |
74 if (evaluationContext.hadTypeConversionError) { | 74 if (evaluationContext.hadTypeConversionError) { |
75 // It is not specified what to do if type conversion fails while evaluat
ing an expression. | 75 // It is not specified what to do if type conversion fails while evaluat
ing an expression. |
76 ec = SYNTAX_ERR; | 76 ec = SyntaxError; |
77 return 0; | 77 return 0; |
78 } | 78 } |
79 | 79 |
80 if (type != XPathResult::ANY_TYPE) { | 80 if (type != XPathResult::ANY_TYPE) { |
81 ec = 0; | 81 ec = 0; |
82 result->convertTo(type, ec); | 82 result->convertTo(type, ec); |
83 if (ec) | 83 if (ec) |
84 return 0; | 84 return 0; |
85 } | 85 } |
86 | 86 |
87 return result; | 87 return result; |
88 } | 88 } |
89 | 89 |
90 } | 90 } |
OLD | NEW |