<?xml version="1.0" encoding="utf-8"?>
<tplcd type="" product="JAZZ">
<lcd_specification>
<DefaultPicture>jazz_default.bmp</DefaultPicture>
<!--video or command -->
<PanelMode>command</PanelMode>
<PanelWidth></PanelWidth>
<PanelHeight></PanelHeight>
<HPulseWidth>0x02</HPulseWidth>
<HBackPorch>0xF0</HBackPorch>
<HFrontPorch>0xF0</HFrontPorch>
<VPulseWidth>0x02</VPulseWidth>
<VBackPorch>0x10</VBackPorch>
<VFrontPorch>0x1C</VFrontPorch>
<!--0x01:board pwr supply ; 0x02 panel pwr supply; 0x03: advance-->
<PWMMode>0x02</PWMMode>
<ColorOrder>BGR</ColorOrder>
<DPhyNum>0x02</DPhyNum>
</lcd_specification>
    TiXmlDocument doc(XmlFile);
bool loadOkay = doc.LoadFile(); if (!loadOkay)
{
MessageBox(_T("Could not load file"));
exit(EXIT_FAILURE);
return FALSE;
} // doc.Print( stdout );
ofstream outFile;
outFile.open("test.log",ios_base::app);
if (!outFile.is_open())//
{
cout << "open OUTPUT file error";
cout << "program terminating.\n"; }
TiXmlElement* tplcdElement = doc.RootElement(); TiXmlElement *Lcd_specific = tplcdElement->FirstChildElement("lcd_specification");
if (Lcd_specific==nullptr)
{
MessageBox(_T("NO lcd_specification"));
return FALSE;
} TiXmlElement *lspec = Lcd_specific->FirstChildElement();//子节点
outFile << lspec->Value() << lspec->GetText() << endl;//略去 TiXmlElement *lllm = lspec->NextSiblingElement(); //
for (lllm = lspec->NextSiblingElement(); lllm != nullptr; lllm = lllm->NextSiblingElement())//lcd_specification read
{ outFile << lllm->Value() << " " << lllm->GetText() << endl; if (!strncmp(lllm->Value(), "PanelWidth", strlen("PanelWidth")))
{
Lcd_Specification.PanelWidth = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "PanelHeight", strlen("PanelHeight")))
{
Lcd_Specification.PanelHeight = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "PanelMode", strlen("PanelMode")))
{
if (!strncmp(lllm->GetText(), "command", strlen("command")))
{
Lcd_Specification.PanelMode = ;//
}
else if (!strncmp(lllm->GetText(), "video", strlen("video")))
{
Lcd_Specification.PanelMode = ;//
} }
if (!strncmp(lllm->Value(), "HPulseWidth", strlen("HPulseWidth")))
{
Lcd_Specification.HPulseWidth = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "HBackPorch", strlen("HBackPorch")))
{
Lcd_Specification.HBackPorch = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "HFrontPorch", strlen("HFrontPorch")))
{
Lcd_Specification.HFrontPorch = strtoul(lllm->GetText(), NULL, );//str类型转ulong
} if (!strncmp(lllm->Value(), "VPulseWidth", strlen("VPulseWidth")))
{
Lcd_Specification.VPulseWidth = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "VBackPorch", strlen("VBackPorch")))
{
Lcd_Specification.VBackPorch = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "VFrontPorch", strlen("VFrontPorch")))
{
Lcd_Specification.VFrontPorch = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "PWMMode", strlen("PWMMode")))
{
Lcd_Specification.PWMMode = strtoul(lllm->GetText(), NULL, );//str类型转ulong
}
if (!strncmp(lllm->Value(), "ColorOrder", strlen("ColorOrder")))
{
if (!strncmp(lllm->GetText(), "BGR", strlen("ColorOrder")))
{
Lcd_Specification.ColorOrder = ;
}
else if (!strncmp(lllm->GetText(), "RGB", strlen("ColorOrder")))
{
Lcd_Specification.ColorOrder = ;
} }
if (!strncmp(lllm->Value(), "DPhyNum", strlen("DPhyNum")))
{
Lcd_Specification.DPhyNum = strtoul(lllm->GetText(), NULL, );//str类型转ulong
} }

附上经典历程网址http://www.cnblogs.com/ziwuge/archive/2011/08/10/2133534.html

这个温度也很不错http://wenku.baidu.com/link?url=9zPLXHr1PzX3I5oYeCizHe1jTbLqaeL13OTou0YIMaEKtPrwXcnyNIqOcOc2pCqV2SfikG4K8KyYu76x7bxttmakqsrbDaQMT9hrCjCnrTO

xml读取节点的更多相关文章

  1. C#使用Linq To XML读取XML,Linq生成XML,Linq创建带属性或带节点XML

    using System; using System.Linq; using System.Xml.Linq; namespace Sample2 { class Program { static v ...

  2. javascript读取xml文件读取节点数据的例子

    分享下用javascript读取xml文件读取节点数据方法. 读取的节点数据,还有一种情况是读取节点属性数据. <head> <title></title> < ...

  3. VB 老旧版本维护系列---读取xml某个节点的值

    读取xml某个节点的值 '定义xml字符串内容地址 Dim xmlFileStr As String = "" '定义所需读取节点的名称 Dim readNodeName As S ...

  4. TreeView 读取 xml 显示节点

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Tree2_xml.aspx.c ...

  5. Linq to XML 读取XML 备忘笔记

    本文转载:http://www.cnblogs.com/infozero/archive/2010/07/13/1776383.html Linq to XML 读取XML 备忘笔记 最近一个项目中有 ...

  6. 根据XPATH去查看修改xml文件节点的内容

    首先给出xml文件解析的路径,然后去读取节点的内容. package com.inetpsa.eqc.threads; import java.util.List; import java.io.Fi ...

  7. C#基础笔记---浅谈XML读取以及简单的ORM实现

    背景: 在开发ASP.NETMVC4 项目中,虽然web.config配置满足了大部分需求,不过对于某些特定业务,我们有时候需要添加新的配置文件来记录配置信息,那么XML文件配置无疑是我们选择的一个方 ...

  8. XML记一次带命名空间的xml读取

    public static void ReadXML(string xmlUrl) { //判断文件是否存在 if (!File.Exists(xmlUrl)) { Console.WriteLine ...

  9. C# xml 读xml、写xml、Xpath、Xml to Linq、xml添加节点 xml修改节点

    #region XDocument //创建XDocument XDocument xdoc2 = new XDocument(); XElement xel1= new XElement(" ...

随机推荐

  1. [LeetCode] Find Median from Data Stream 找出数据流的中位数

    Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...

  2. jQuery 常用速查

    jQuery 速查 基础 $("css 选择器") 选择元素,创建jquery对象 $("html字符串") 创建jquery对象 $(callback) $( ...

  3. python命名空间

    在"python之禅"那几句话中有一句:namespace is a good thing. python对于命名空间的处理非常简单,下面的内容不一定真实,完全是我根据现象推测出来 ...

  4. 【WPF】 Timer与 dispatcherTimer 在wpf中你应该用哪个?

    源:Roboby 1.timer或重复生成timer事件,dispatchertimer是集成到队列中的一个时钟.2.dispatchertimer更适合在wpf中访问UI线程上的元素 3.Dispa ...

  5. OC中的多继承

    可以间接实现,方法有: 1.消息转发 2.协议 3.组合模式 4.代理 5.分类 直接上code,分别说明集中方法的实现 一.消息转发 消息转发可以参考我的另外一篇博客:http://www.cnbl ...

  6. jsp编码过程

    pageEncoding是jsp文件本身的编码 contentType的charset是指浏览器到服务器发送时使用的编码:以及服务器返回到浏览器使用的编码 JSP要经过三次的“编码” 第一阶段会用JS ...

  7. cx_Oracle摘记

    由于想使用python操作oracle所以查看了cx_Oracle的官方文档,同时也查看了twisted中cx_Oracle的使用.下面是摘自文档中一些我认为有用的内容 cx_Oracle is a ...

  8. Leetcode 15. 3Sum

    Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...

  9. 将一张表的数据,拷贝到另一张表中sql

    两张表的字段一样 create table 目标表 as  select * from 原表;

  10. Ajax方式上传文件

    用到两个对象 第一个对象:FormData 第二个对象:XMLHttpRequest 目前新版的Firefox 与 Chrome 等支持HTML5的浏览器完美的支持这两个对象,但IE9尚未支持 For ...