|
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 using SymbianXmlInputLib.Elements.Types.Category; |
|
26 |
|
27 namespace SymbianXmlInputLib.Parser.Nodes |
|
28 { |
|
29 public class SXILParserNodeCategory : SXILParserNode |
|
30 { |
|
31 #region Constructors |
|
32 public SXILParserNodeCategory( string aName ) |
|
33 { |
|
34 iName = aName; |
|
35 } |
|
36 #endregion |
|
37 |
|
38 #region From SXILParserNode |
|
39 public override bool IsMulti |
|
40 { |
|
41 get { return true; } |
|
42 } |
|
43 |
|
44 public override bool CanHandle( XmlNode aNode ) |
|
45 { |
|
46 bool ret = base.CanHandle( aNode ); |
|
47 // |
|
48 if ( !ret ) |
|
49 { |
|
50 string name = aNode.Name.Trim().ToUpper(); |
|
51 if ( name == "CATEGORY" ) |
|
52 { |
|
53 // Is it our category? |
|
54 foreach ( XmlAttribute attrib in aNode.Attributes ) |
|
55 { |
|
56 name = attrib.Name.ToUpper(); |
|
57 if ( name == "NAME" ) |
|
58 { |
|
59 string value = attrib.Value.Trim().ToUpper(); |
|
60 if ( value == iName.ToUpper() ) |
|
61 { |
|
62 ret = true; |
|
63 break; |
|
64 } |
|
65 } |
|
66 } |
|
67 } |
|
68 } |
|
69 // |
|
70 return ret; |
|
71 } |
|
72 |
|
73 public override void XmlParse( XmlNode aNode ) |
|
74 { |
|
75 System.Diagnostics.Debug.Assert( aNode.Name.ToUpper() == "CATEGORY" ); |
|
76 System.Diagnostics.Debug.Assert( aNode.Attributes.Count >= 1 ); |
|
77 |
|
78 SXILElementCategory category = new SXILElementCategory( iName ); |
|
79 base.Document.AppendChild( category ); |
|
80 base.Document.CurrentNode = category; |
|
81 // |
|
82 base.XmlParse( aNode ); |
|
83 // |
|
84 base.Document.MakeParentCurrent(); |
|
85 } |
|
86 #endregion |
|
87 |
|
88 #region From System.Object |
|
89 public override int GetHashCode() |
|
90 { |
|
91 return iName.GetHashCode(); |
|
92 } |
|
93 #endregion |
|
94 |
|
95 #region Properties |
|
96 #endregion |
|
97 |
|
98 #region Internal methods |
|
99 private readonly string iName; |
|
100 #endregion |
|
101 } |
|
102 } |