Click here to Skip to main content
15,915,093 members
Home / Discussions / C#
   

C#

 
GeneralRe: Attempted to read and write protected memory… ActiveX on Vista Pin
Pete O'Hanlon4-Mar-08 23:13
mvePete O'Hanlon4-Mar-08 23:13 
GeneralRe: Attempted to read and write protected memory… ActiveX on Vista Pin
anderslundsgard5-Mar-08 0:41
anderslundsgard5-Mar-08 0:41 
GeneralRe: Attempted to read and write protected memory… ActiveX on Vista Pin
mav.northwind5-Mar-08 3:21
mav.northwind5-Mar-08 3:21 
GeneralRe: Attempted to read and write protected memory… ActiveX on Vista Pin
anderslundsgard5-Mar-08 4:11
anderslundsgard5-Mar-08 4:11 
GeneralRe: Attempted to read and write protected memory… ActiveX on Vista Pin
Devil's Priest3-Jun-09 0:33
Devil's Priest3-Jun-09 0:33 
GeneralXML Element close tag appearing on new line Pin
Chazzysb4-Mar-08 4:12
Chazzysb4-Mar-08 4:12 
GeneralRe: XML Element close tag appearing on new line Pin
Pete O'Hanlon4-Mar-08 4:41
mvePete O'Hanlon4-Mar-08 4:41 
QuestionHelp in selecting attributes with XPath [modified] Pin
student_rhr4-Mar-08 4:02
student_rhr4-Mar-08 4:02 
<field name="textBox" y="3.175" x="3.17" w="62" h="9">
  <ui>
    <textBox>
      <border>
        <css style="">            </css>
      </border>
      <margin/>
    </textBox>
  </ui>
  <font face="Arial"/>
  <margin topInset="1" bottomInset="1" leftInset="1" rightInset="1"/>
  <textAlign vAlign="middle"/>
  <label reserve="25">
    <Font fontFace="Arial" size="8pt" />
    <textAlign vAlign="middle"/>
    <value>
      <text>textbox label</text>
    </value>
  </label>
</field>

So I am trying to read the values of Font (IF there is a textBox element present) and trying to read the attributes fontFace and size, here is my Xpath:
            XPathNodeIterator iterator = nav.Select(@"/field");
            try
            {
                while (iterator.MoveNext())
                {
                    //Do some other stuff
                    ...
                    XPathNavigator nav2 = iterator.Current.Clone();
                    if (string.Compare(nav2.Name, "field") == 0)
                    {
                    XPathNodeIterator textBoxIterator = nav2.Select("child::*/child::textBox");

                    if (textBoxIterator.Count > 0)
                    {
                        XPathExpression exp = nav2.Compile("child::Font");
                        XPathNodeIterator it = nav2.Select(exp);

                        while (it.MoveNext())
                        {
                            XPathNavigator nav3 = it.Current.Clone();
                            string fontFace = nav3.GetAttribute("typeface", nav3.NamespaceURI);
                            string fontSize = nav3.GetAttribute("size", nav3.NamespaceURI);
                        }
                    }
                }
             }
             catch
...
}

Am I doing it the proper way or is it too complicated and can be simplified?

modified on Tuesday, March 4, 2008 10:22 AM

GeneralRe: Help in selecting attributes with XPath Pin
Christian Graus4-Mar-08 9:22
protectorChristian Graus4-Mar-08 9:22 
QuestionAccess audio files from resources Pin
JustRonald4-Mar-08 4:00
JustRonald4-Mar-08 4:00 
AnswerRe: Access audio files from resources Pin
Eslam Afifi4-Mar-08 4:26
Eslam Afifi4-Mar-08 4:26 
GeneralRe: Access audio files from resources [modified] Pin
DaveyM694-Mar-08 4:53
professionalDaveyM694-Mar-08 4:53 
GeneralSerial port communication Pin
t_nedelchev4-Mar-08 3:59
t_nedelchev4-Mar-08 3:59 
GeneralRe: Serial port communication Pin
Matthew Butler4-Mar-08 4:46
Matthew Butler4-Mar-08 4:46 
GeneralRe: Serial port communication Pin
t_nedelchev4-Mar-08 20:45
t_nedelchev4-Mar-08 20:45 
GeneralRe: Serial port communication Pin
DaveyM694-Mar-08 22:19
professionalDaveyM694-Mar-08 22:19 
GeneralRe: Serial port communication Pin
t_nedelchev4-Mar-08 22:59
t_nedelchev4-Mar-08 22:59 
GeneralRe: Serial port communication Pin
DaveyM694-Mar-08 23:53
professionalDaveyM694-Mar-08 23:53 
GeneralRe: Serial port communication Pin
t_nedelchev5-Mar-08 0:05
t_nedelchev5-Mar-08 0:05 
GeneralRe: Serial port communication Pin
DaveyM695-Mar-08 0:51
professionalDaveyM695-Mar-08 0:51 
GeneralRe: Serial port communication Pin
t_nedelchev5-Mar-08 1:16
t_nedelchev5-Mar-08 1:16 
GeneralRe: Serial port communication Pin
DaveyM695-Mar-08 1:25
professionalDaveyM695-Mar-08 1:25 
GeneralRe: Serial port communication Pin
t_nedelchev5-Mar-08 1:40
t_nedelchev5-Mar-08 1:40 
GeneralProblem programatically deleting worksheet from excel file Pin
Goalie354-Mar-08 3:38
Goalie354-Mar-08 3:38 
GeneralRe: Problem programatically deleting worksheet from excel file Pin
Laddie4-Mar-08 4:53
Laddie4-Mar-08 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.