|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.IO; |
|
19 using System.Xml; |
|
20 using System.Text; |
|
21 using System.Collections.Generic; |
|
22 using SymbianTree; |
|
23 using SymbianUtils; |
|
24 using SymbianXmlInputLib.Elements; |
|
25 |
|
26 namespace SymbianXmlInputLib.Parser.Nodes |
|
27 { |
|
28 public abstract class SXILParserNode |
|
29 { |
|
30 #region Constructors |
|
31 protected SXILParserNode() |
|
32 : this( string.Empty ) |
|
33 { |
|
34 } |
|
35 |
|
36 protected SXILParserNode( string aDescription ) |
|
37 { |
|
38 iDescription = aDescription; |
|
39 } |
|
40 #endregion |
|
41 |
|
42 #region Framework API |
|
43 public virtual void XmlParse( XmlNode aNode ) |
|
44 { |
|
45 foreach ( XmlNode child in aNode.ChildNodes ) |
|
46 { |
|
47 iChildren.XmlParse( child, Parser ); |
|
48 } |
|
49 } |
|
50 |
|
51 public virtual bool CanHandle( XmlNode aNode ) |
|
52 { |
|
53 return false; |
|
54 } |
|
55 |
|
56 public virtual bool IsMulti |
|
57 { |
|
58 get { return false; } |
|
59 } |
|
60 #endregion |
|
61 |
|
62 #region Properties |
|
63 public SXILParserNodeCollection Children |
|
64 { |
|
65 get { return iChildren; } |
|
66 set { iChildren = value; } |
|
67 } |
|
68 |
|
69 protected SXILDocument Document |
|
70 { |
|
71 get { return Parser.Document; } |
|
72 } |
|
73 |
|
74 internal SXILParser Parser |
|
75 { |
|
76 get { return iParser; } |
|
77 set { iParser = value; } |
|
78 } |
|
79 #endregion |
|
80 |
|
81 #region From System.Object |
|
82 public override int GetHashCode() |
|
83 { |
|
84 int ret = 0; |
|
85 // |
|
86 if ( string.IsNullOrEmpty( iDescription ) ) |
|
87 { |
|
88 ret = this.GetType().GetHashCode(); |
|
89 } |
|
90 else |
|
91 { |
|
92 ret = iDescription.GetHashCode(); |
|
93 } |
|
94 // |
|
95 return ret; |
|
96 } |
|
97 #endregion |
|
98 |
|
99 #region Data members |
|
100 private readonly string iDescription; |
|
101 private SXILParser iParser = null; |
|
102 private SXILParserNodeCollection iChildren = new SXILParserNodeCollection(); |
|
103 #endregion |
|
104 } |
|
105 } |