[gxml/xpath: 6/8] XPath: xml_error_msg -> GXml.get_last_error_msg; DomError -> GXml.Error; temporary, will decide on h
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/xpath: 6/8] XPath: xml_error_msg -> GXml.get_last_error_msg; DomError -> GXml.Error; temporary, will decide on h
- Date: Tue, 15 Oct 2013 15:53:09 +0000 (UTC)
commit 2f4fe1ea6b2678c9bf3abf3b2d5dc5b578f5450c
Author: Richard Schwarting <aquarichy gmail com>
Date: Tue Oct 15 11:50:31 2013 -0400
XPath: xml_error_msg -> GXml.get_last_error_msg; DomError -> GXml.Error; temporary, will decide on how to
handle errors soon.
gxml/Error.vala | 5 +++--
gxml/Node.vala | 4 ++--
gxml/XPathExpression.vala | 12 ++++++------
3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/gxml/Error.vala b/gxml/Error.vala
index af367a8..f8c2422 100644
--- a/gxml/Error.vala
+++ b/gxml/Error.vala
@@ -1,5 +1,6 @@
namespace GXml {
public errordomain Error {
+ NOT_SUPPORTED, /* TODO: GET RID OF THIS */
PARSER, WRITER;
}
@@ -8,7 +9,7 @@ namespace GXml {
* Returns error message for last registered error.
*/
internal static string get_last_error_msg () {
- Xml.Error* error = Xml.get_last_error ();
+ Xml.Error* error = Xml.Error.get_last_error ();
if (error == null)
return "No error reported by libxml2";
@@ -16,7 +17,7 @@ namespace GXml {
return libxml2_error_to_string (error);
}
- // TODO: replace usage of this with xml_error_msg
+ // TODO: replace usage of this with GXml.get_last_error_msg
internal static string libxml2_error_to_string (Xml.Error *e) {
return "%s:%s:%d: %s:%d: %s".printf (
e->level.to_string ().substring (8 /* skipping XML_ERR_ */),
diff --git a/gxml/Node.vala b/gxml/Node.vala
index 67d2f90..de9a164 100644
--- a/gxml/Node.vala
+++ b/gxml/Node.vala
@@ -504,12 +504,12 @@ namespace GXml {
* @param nsr namespace resolver object (prefix -> URI mapping)
* @param res_type type to cast resulting value to
* @return XPath.Result object containing result type and value
- * @throws DomError when node type is not supported as context of evaluation
+ * @throws GXml.Error when node type is not supported as context of evaluation
* @throws XPath.Error when supplied with invalid XPath expression
*/
public XPath.Result evaluate (string expr, XPath.NSResolver? nsr = null,
XPath.ResultType res_type = XPath.ResultType.ANY)
- throws DomError, XPath.Error
+ throws GXml.Error, XPath.Error
{
var expression = new XPath.Expression (expr, nsr);
return expression.evaluate (this, res_type);
diff --git a/gxml/XPathExpression.vala b/gxml/XPathExpression.vala
index a5d9529..a4a2da5 100644
--- a/gxml/XPathExpression.vala
+++ b/gxml/XPathExpression.vala
@@ -44,7 +44,7 @@ namespace GXml.XPath {
public Expression (string expr, NSResolver? ns_resolver = null) throws XPath.Error {
expression = Xml.XPath.compile(expr);
if (expression == null)
- throw new XPath.Error.INVALID_EXPRESSION (xml_error_msg ());
+ throw new XPath.Error.INVALID_EXPRESSION (GXml.get_last_error_msg ());
this.ns_resolver = ns_resolver;
}
@@ -58,11 +58,11 @@ namespace GXml.XPath {
* @param context_node context node for the evaluation of this XPath expression
* @param res_type type to cast resulting value to
* @return XPath.Result object containing result type and value
- * @throws DomError when node type is not supported as context of evaluation
+ * @throws GXml.Error when node type is not supported as context of evaluation
* @throws XPath.Error when supplied with invalid XPath expression
*/
public Result evaluate (Node context_node,
- ResultType res_type = ResultType.ANY) throws XPath.Error, DomError
+ ResultType res_type = ResultType.ANY) throws XPath.Error, GXml.Error
{
Document doc = (context_node is Document) ? (Document) context_node :
context_node.owner_document;
doc.sync_dirty_elements ();
@@ -86,7 +86,7 @@ namespace GXml.XPath {
// }
else if (context_node is ProcessingInstruction) {
/* There is no Xml.Node* field in ProcessingInstruction implementation */
- throw new DomError.NOT_SUPPORTED("Not implemented");
+ throw new GXml.Error.NOT_SUPPORTED("Not implemented");
}
if (ns_resolver != null)
@@ -98,12 +98,12 @@ namespace GXml.XPath {
throw new XPath.Error.INVALID_EXPRESSION ("Namespace prefix "
+
"and/or URI cannot be empty strings");
if (context.register_ns (entry.key, entry.value) == -1)
- throw new XPath.Error.INVALID_EXPRESSION (xml_error_msg ());
+ throw new XPath.Error.INVALID_EXPRESSION
(GXml.get_last_error_msg ());
}
Xml.XPath.Object* xml_result = context.compiled_eval (expression);
if (xml_result == null)
- throw new XPath.Error.INVALID_EXPRESSION (xml_error_msg ());
+ throw new XPath.Error.INVALID_EXPRESSION (GXml.get_last_error_msg ());
Result result = new Result (doc, xml_result);
if (res_type != ResultType.ANY) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]