File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,12 @@ public void DoXMLPase(ref string content)
48
48
{
49
49
XmlDocument xml = new XmlDocument ( ) ;
50
50
xml . LoadXml ( content ) ;
51
+ XmlElement rootNode = xml . DocumentElement ;
51
52
52
- XmlNode info = xml . GetElementsByTagName ( "info" ) [ 0 ] ;
53
- XmlNode common = xml . GetElementsByTagName ( "common" ) [ 0 ] ;
54
- XmlNodeList pages = xml . GetElementsByTagName ( "pages" ) [ 0 ] . ChildNodes ;
55
- XmlNodeList chars = xml . GetElementsByTagName ( "chars" ) [ 0 ] . ChildNodes ;
53
+ XmlNode info = rootNode . SelectSingleNode ( "info" ) ;
54
+ XmlNode common = rootNode . SelectSingleNode ( "common" ) ;
55
+ XmlNodeList pages = rootNode . SelectNodes ( "pages/page" ) ;
56
+ XmlNodeList chars = rootNode . SelectNodes ( "chars/char" ) ;
56
57
57
58
58
59
fontName = info . Attributes . GetNamedItem ( "face" ) . InnerText ;
@@ -89,10 +90,9 @@ public void DoXMLPase(ref string content)
89
90
}
90
91
91
92
// kernings
92
- XmlNode kerningsNode = xml . GetElementsByTagName ( "kernings" ) [ 0 ] ;
93
- if ( kerningsNode != null && kerningsNode . HasChildNodes )
93
+ XmlNodeList kerns = rootNode . SelectNodes ( "kernings/kerning" ) ;
94
+ if ( kerns != null && kerns . Count > 0 )
94
95
{
95
- XmlNodeList kerns = kerningsNode . ChildNodes ;
96
96
kernings = new Kerning [ kerns . Count ] ;
97
97
for ( int i = 0 ; i < kerns . Count ; i ++ )
98
98
{
You can’t perform that action at this time.
0 commit comments