25 |
|
|
26 |
using System; |
using System; |
27 |
using System.Runtime.Serialization; |
using System.Runtime.Serialization; |
28 |
|
using System.Xml.XPath; |
29 |
|
|
30 |
namespace System.Xml.Xsl |
namespace System.Xml.Xsl |
31 |
{ |
{ |
32 |
|
#if CONFIG_SERIALIZATION |
33 |
|
[Serializable] |
34 |
|
#endif |
35 |
public class XsltException: System.SystemException |
public class XsltException: System.SystemException |
36 |
{ |
{ |
37 |
[TODO] |
private int lineNumber; |
38 |
|
private int linePosition; |
39 |
|
private String sourceUri; |
40 |
|
|
41 |
|
private static String CreateMessage(String message, XPathNavigator nav) |
42 |
|
{ |
43 |
|
IXmlLineInfo li = nav as IXmlLineInfo; |
44 |
|
int lineNumber = li != null ? li.LineNumber : 0; |
45 |
|
int linePosition = li != null ? li.LinePosition : 0; |
46 |
|
String sourceUri = nav != null ? nav.BaseURI : String.Empty; |
47 |
|
return CreateMessage(lineNumber, linePosition, sourceUri, message); |
48 |
|
} |
49 |
|
|
50 |
|
private static String CreateMessage(int lineNumber, int linePosition, |
51 |
|
String sourceUri, String msg) |
52 |
|
{ |
53 |
|
if(sourceUri != null) |
54 |
|
{ |
55 |
|
msg = String.Concat(msg, " ", sourceUri); |
56 |
|
} |
57 |
|
if(lineNumber != 0) |
58 |
|
{ |
59 |
|
msg = String.Concat(msg, " line ", lineNumber); |
60 |
|
} |
61 |
|
if(linePosition != 0) |
62 |
|
{ |
63 |
|
msg = String.Concat(msg, ", position ", linePosition); |
64 |
|
} |
65 |
|
return msg; |
66 |
|
} |
67 |
|
|
68 |
|
#if CONFIG_FRAMEWORK_2_0 |
69 |
|
public XsltException() : base(String.Empty, null) |
70 |
|
{ |
71 |
|
} |
72 |
|
|
73 |
|
public XsltException(String message) : base(message, null) |
74 |
|
{ |
75 |
|
} |
76 |
|
#endif |
77 |
|
|
78 |
public XsltException(String message, Exception innerException) |
public XsltException(String message, Exception innerException) |
79 |
|
: base(message, innerException) |
80 |
|
{ |
81 |
|
} |
82 |
|
|
83 |
|
protected internal XsltException(String sourceUri, int lineNumber, |
84 |
|
int linePosition, Exception innerException) |
85 |
|
: base(CreateMessage(lineNumber, linePosition, sourceUri, String.Empty), |
86 |
|
innerException) |
87 |
{ |
{ |
|
throw new NotImplementedException(".ctor"); |
|
88 |
} |
} |
89 |
|
|
90 |
#if CONFIG_SERIALIZATION |
#if CONFIG_SERIALIZATION |
91 |
|
|
|
[TODO] |
|
92 |
protected XsltException(SerializationInfo info, |
protected XsltException(SerializationInfo info, |
93 |
StreamingContext context) |
StreamingContext context) |
94 |
{ |
{ |
95 |
throw new NotImplementedException(".ctor"); |
lineNumber = info.GetInt32("lineNumber"); |
96 |
|
linePosition = info.GetInt32("linePosition"); |
97 |
|
sourceUri = info.GetString("sourceUri"); |
98 |
} |
} |
99 |
|
|
|
[TODO] |
|
100 |
public override void GetObjectData(SerializationInfo info, |
public override void GetObjectData(SerializationInfo info, |
101 |
StreamingContext context) |
StreamingContext context) |
102 |
{ |
{ |
103 |
throw new NotImplementedException("GetObjectData"); |
base.GetObjectData(info, context); |
104 |
|
info.AddValue("lineNumber", lineNumber); |
105 |
|
info.AddValue("linePosition", linePosition); |
106 |
|
info.AddValue("sourceUri", sourceUri); |
107 |
} |
} |
108 |
|
|
109 |
#endif |
#endif |
110 |
|
|
|
[TODO] |
|
111 |
public int LineNumber |
public int LineNumber |
112 |
{ |
{ |
113 |
get |
get |
114 |
{ |
{ |
115 |
throw new NotImplementedException("LineNumber"); |
return lineNumber; |
116 |
} |
} |
|
|
|
117 |
} |
} |
118 |
|
|
|
[TODO] |
|
119 |
public int LinePosition |
public int LinePosition |
120 |
{ |
{ |
121 |
get |
get |
122 |
{ |
{ |
123 |
throw new NotImplementedException("LinePosition"); |
return linePosition; |
124 |
} |
} |
|
|
|
125 |
} |
} |
126 |
|
|
|
[TODO] |
|
127 |
public override String Message |
public override String Message |
128 |
{ |
{ |
129 |
get |
get |
130 |
{ |
{ |
131 |
throw new NotImplementedException("Message"); |
String msg = base.Message; |
132 |
|
if(sourceUri != null) |
133 |
|
{ |
134 |
|
msg = String.Concat(msg, " ", sourceUri); |
135 |
|
} |
136 |
|
if(lineNumber != 0) |
137 |
|
{ |
138 |
|
msg = String.Concat(msg, " line ", lineNumber); |
139 |
|
} |
140 |
|
if(linePosition != 0) |
141 |
|
{ |
142 |
|
msg = String.Concat(msg, ", position ", linePosition); |
143 |
|
} |
144 |
|
return msg; |
145 |
} |
} |
|
|
|
146 |
} |
} |
147 |
|
|
|
[TODO] |
|
148 |
public String SourceUri |
public String SourceUri |
149 |
{ |
{ |
150 |
get |
get |
151 |
{ |
{ |
152 |
throw new NotImplementedException("SourceUri"); |
return sourceUri; |
153 |
} |
} |
|
|
|
154 |
} |
} |
155 |
|
|
156 |
} |
} |