Why XmlTextReader skip lines after style:name="T103" closing tag?

185 Views Asked by At

My program is meant to read content.xml file.
So after it read style:name="T103" closing tag, it will use reader.Read() function and then it jumps to </office:automatic-styles> tag.
Skipping everything to that tag.
Why is that?

<style:style style:name="T101" style:family="text">
  <style:text-properties style:font-name="Arial1" fo:font-size="10pt" style:font-size-asian="10pt" style:font-name-complex="Arial3"/>
</style:style>
<style:style style:name="T102" style:family="text">
  <style:text-properties style:font-name="Arial1" fo:font-style="normal" style:font-style-asian="normal" style:font-name-complex="Arial3"/>
</style:style>
<style:style style:name="T103" style:family="text">
  <style:text-properties style:font-name="Arial1" fo:font-style="normal" style:font-style-asian="normal" style:font-name-complex="Arial3" style:font-size-complex="12pt"/>
</style:style>
<style:style style:name="T104" style:family="text">
  <style:text-properties style:font-name="Arial1" fo:font-style="normal" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:font-style-asian="normal" style:font-name-complex="Arial3" style:font-size-complex="12pt"/>
</style:style>

Code for <style:style> tag:

public void style_style()
{
    reader.MoveToFirstAttribute();
    if (reader.Name == "style:name")
    {
        if (!(reader.Value.StartsWith("Table")))
            if (reader.Value.StartsWith("T"))
                styleName = reader.Value;
        if (styleName == "T103")
            Console.Write("");
    }

}

and for <style:text-properties>:

public void style_text_properties()
{
    while (reader.MoveToNextAttribute())
    {
        if (styleName.Length > 1)
            switch (reader.Name)
            {
                case "fo:font-style":
                    if (reader.Value == "italic")
                        isItalic = true;
                    break;
                case "style:text-underline-style":
                    if (reader.Value == "solid")
                        isUnderline = true;
                    break;
                case "fo:font-weight":
                    if (reader.Value == "bold")
                        isBold = true;
                    break;
            }
    }
}

I tried to debug and I just find out that after its in </style:style> node, for style:name="T103" it skips every node till </office:automatic-styles>.
That node is the last closing tag after all style nodes.

Why does it do that?

0

There are 0 best solutions below