<?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. Zend Framework 1 - Quick Start

    创建 Zend 项目 要创建 Zend 项目,首先要下载并解压 Zend Framework. 安装 Zend Framework 下载最新的 Zend Framework 1.12.20 源码包,( ...

  2. Unity 最佳实践

    转帖:http://www.glenstevens.ca/unity3d-best-practices/ 另外可以参考:http://devmag.org.za/2012/07/12/50-tips- ...

  3. 语义网 (Semantic Web)和 web 3.0

    语义网=有意义的网络. "如果说 HTML 和 WEB 将整个在线文档变成了一本巨大的书,那么 RDF, schema, 和 inference languages 将会使世界上所有的数据变 ...

  4. hibernate通过注解实现实体和表的映射

    参考: 表名的映射: //代表此类参与ORM映射,此注解必须要有 @Entity //代表user这个类映射了一个表user50,如果表名和类名一样,此注解可以省略 @Table(name=" ...

  5. 【BZOJ 4581】【Usaco2016 Open】Field Reduction

    http://www.lydsy.com/JudgeOnline/problem.php?id=4581 考虑\(O(n^3)\)暴力. 实际上枚举最靠边的三个点就可以了,最多有12个点. 还是暴力= ...

  6. replace和translate的用法

    select replace ('111222333444','222','888') from dual;with tmp as(select 'aabb/123\:cde工人' s from du ...

  7. Cordova应用程序修改启动画面或者Icon

    1)  制作启动画面图片或icon ionic resources //同时生成icon和splash ionic resources --icon //只生成icon ionic resources ...

  8. 图说C++对象模型:对象内存布局详解

    0.前言 文章较长,而且内容相对来说比较枯燥,希望对C++对象的内存布局.虚表指针.虚基类指针等有深入了解的朋友可以慢慢看. 本文的结论都在VS2013上得到验证.不同的编译器在内存布局的细节上可能有 ...

  9. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  10. Hibernate组件和关联映射

    一.基本定义 组件:建立一个类,为了方便代码复用和建立模型,但类在数据库中并没有对应的表,此类可以作为一个组件插入到其他类中(有数据表的类) 组件和关联映射的关系是组件是没有对应的类;组件是值类型的, ...