版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、查看硬件信息命令1, 主板信息.查看主板的序列号-#使用命令dmidecode | grep -i serial number#查看板卡信息cat /proc/pci-2, cpu信息-#通过/proc文件系统1) cat /proc/cpuinfo#通过查看开机信息2) dmesg | grep -i cpu#3)dmidecode -t processor-3, 硬盘信息-#查看分区情况fdisk -l#查看大小情况df -h#查看使用情况du -h#hdparm -I /dev/sda#dmesg | grep sda-4, 内存信息-1) cat /proc/meminfo2) dme
2、sg | grep mem3) free -m4) vmstat5) dmidecode | grep -i mem-5, 网卡信息-1) dmesg | grep -i eth2) cat /etc/sysconfig/hwconf | grep -i eth3) lspci | grep -i eth-6, 鼠标键盘和USB信息查看键盘和鼠标:cat /proc/bus/input/devices查看USB设备:cat /proc/bus/usb/devices查看各设备的中断请求(IRQ):cat /proc/interrupts7, 显卡信息-1)lspci |grep -i VGA2
3、)dmesg | grep -i VGA-8, 声卡信息-1)lspci |grep -i VGA2)dmesg | grep -i VGA-7, 其他命令.用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart).dmesg (查看所有启动时检测到的硬件信息).lspci (显示外设信息, 如usb,网卡等信息).cat /etc/sysconfig/hwconf.mpstat8, 需要手动安装的工具lshw,hwinfo,hal-device-manager9, Solaris如何检测硬件参数俺从别处发现了些有意思的东西:Solaris的硬件相
4、关命令发表:2004-3-8 11:20:36 出处:你的博客网()-1)查看当前处理器的类型和速度(主频)# psrinfo vStatus of processor 1 as of: 11/24/01 10:34:41Processor has been on-line since 11/24/01 10:18:20.The sparcv9 processor operates at 432 MHz, and has a sparcv9 floating point processor.Status of processor 3 as of: 11/24/01 10:34:41Proces
5、sor has been on-line since 11/24/01 10:18:22.The sparcv9 processor operates at 432 MHz, and has a sparcv9 floating point processor.2)打印当前的OBP版本号# prtconf VOBP 3.20.0 2000/10/24 10:47# /usr/platform/sun4u/sbin/prtdiag v | grep OBPOBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49ok. .versionRele
6、ase 3.20 Version 0 created 2000/10/24 10:47OBP 3.20.0 2000/10/24 10:47POST 6.1.0 2000/10/24 10:49OBDIAG 4.5.1 2000/10/24 10:483)查看硬盘物理信息(vendor, RPM, Capacity)# iostat Esd0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0Vendor: SEAGATE Product: ST34371W SUN4.2G Revision: 7462 Serial No:JDX394220KW
7、 EBCSize: 4.29GB ;Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0Illegal Request: 0 Predictive Failure Analysis: 0sd2 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0Vendor: FUJITSU Product: MAJ3364M SUN36G Revision: 0804 Serial No: 01M18144Size: 36.42GB ;Media Error: 0 Device Not Re
8、ady: 0 No Device: 0 Recoverable: 0Illegal Request: 0 Predictive Failure Analysis: 0sd3 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0Vendor: FUJITSU Product: MAJ3364M SUN36G Revision: 0804 Serial No: 01M16199Size: 36.42GB ;Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0Illegal Requ
9、est: 0 Predictive Failure Analysis: 0sd21 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0Vendor: TOSHIBA Product: DVD-ROM SD-M1401 Revision: 1007 Serial No: 06/22/00Size:71GB ;Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0Illegal Request: 0 Predictive Failure Analysis:
10、 04)查看磁盘的几何参数和分区信息# prtvtoc /dev/rdsk/c0t0d0s0* /dev/rdsk/c0t0d0s0 partition map* Dimensions:* 512 bytes/sector* 135 sectors/track* 16 tracks/cylinder* 2160 sectors/cylinder* 3882 cylinders* 3880 accessible cylinders* Flags:* 1: unmountable* 10: read-only* Unallocated space:* First Sector Last* Sect
11、or Count Sector* 8277120 103680 8380799* First Sector Last* Partition Tag Flags Sector Count Sector Mount Directory 0 2 00 0 2049840 2049839 / 1 3 01 2049840 615600 2665439 2 5 00 0 8380800 8380799 5 0 00 2665440 2458080 5123519 /opt 6 4 00 5123520 3073680 8197199 /usr7 8 00 8197200 79920 8277119 /e
12、xport/home5)显示已经使用和未使用的i-node数目# df F ufs o iFilesystem iused ifree %iused Mounted on/dev/dsk/c0t0d0s0 7859 479821 2% /dev/dsk/c0t0d0s6 37763 339517 10% /usr/dev/dsk/c0t0d0s5 722 301102 0% /opt/dev/dsk/c0t0d0s7 4 24380 0% /export/home6).显示cpu使用率最高的进程# ps eo pid,pcpu,args | sort +1n该命令输出当前系统进程的pid, C
13、PU占用率及命令描述,并以pcpu来排序7)显示内存占用率最高的进程# ps eo pid,vsz,args | sort +1n该命令输出当前系统进程的pid,内存占用率及命令描述,并以vsz来排序8)查看及启动系统的32位或64位内核模式64位模式# isalist vsparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7sparc# isainfo v64-bit sparcv9 applications32-bit sparc applications# isainfo b64启动64
14、位内核模式ok. boot kernel/sparcv9/unix32位模式# isalist vsparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc# isainfo v32-bit sparc applications# isainfo b32启动32位模式ok. boot kernel/unix9)查看当前的OpenWindows版本# showrev wOpenWindows version:X11 Version 6.4.1 5 November 200110)查看当前CDE的版本# /usr/ccs/bin
15、/what /usr/dt/bin/dtmail/usr/dt/bin/dtmail: CDE Version 1.4.6_06 CDEVersion1.4.6_0611)测定当前的显示器刷新频率/usr/sbin/ffbconfig rev ?Valid values for -res option are:1024x768x60 11024x768x70 11024x768x75 1 21024x768x771024x800 x841152x900 x661152x900 x761280 x800 x76 1 21280 x1024x60 1 21280 x1024x671280 x102
16、4x761280 x1024x85 1 2960 x680 x112s960 x680 x108s640 x480 x60 1 2640 x480 x60i 1768x575x50i 11440 x900 x76 1 21600 x1000 x66 1 21600 x1000 x76 1 21600 x1280 x76 1 21920 x1080 x72 1 21920 x1080 x76 1 21920 x1200 x70 1 21920 x1200 x75 1 2svga 111521280stereovga 1 2ntsc 1pal 1noneNotes:1 monitor does n
17、ot support this resolution.2 this version of FFB (FFB1) does not support this resolution12)查看系统配置# /usr/platform/sun4u/sbin/prtdiag vSystem Configuration: Sun Microsystems sun4u Sun Enterprise 450 (2 XUltraSPARC-II 432MHz)System clock frequency: 86 MHzMemory size: 1024 Megabytes= CPUs = Run Ecache C
18、PU CPUBrd CPU Module MHz MB Impl. Mask-More- - - - - - -SYS 1 1 432 4.0 US-II 10.0SYS 3 3 432 4.0 US-II 10.0= Memory = Interlv. Socket SizeBank Group Name (MB) Status- - - - -0 none 1901 256 OK0 none 1902 256 OK0 none 1903 256 OK0 none 1904 256 OK0 none 1701 256 OK0 none 1702 256 OK= IO Cards =No fa
19、ilures found in System= Environmental Status =System Temperatures (Celsius):-AMBIENT 20CPU 1 40CPU 3 40=Front Status Panel:-Keyswitch position is in On mode.System LED Status: POWER GENERAL ERROR ACTIVITY ON OFF ON DISK ERROR THERMAL ERROR POWER SUPPLY ERROR OFF OFF OFFDisk LED Status: OK = GREEN ER
20、ROR = YELLOW DISK 2: OK DISK 3: OK DISK 0: OK DISK 1: EMPTY=Fans:-Fan Bank Speed Status- - -CPU 49 OKPWR 31 OKPower Supplies:-Supply Rating Temp Status- - - -0 550 W 33 OK1 550 W 33 OK= HW Revisions =ASIC Revisions:-STP2223BGA: Rev 4STP2223BGA: Rev 4STP2223BGA: Rev 4STP2003QFP: Rev 1STP2205BGA: Rev
21、1System PROM revisions:-OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49# sysdef* Hostid*80fee99b* sun4u Configuration* Devices*packages (driver not attached) terminal-emulator (driver not attached) deblocker (driver not attached) obp-tftp (driver not attached) disk-label (driver not attached
22、) SUNW,builtin-drivers (driver not attached) sun-keyboard (driver not attached) ufs-file-system (driver not attached)chosen (driver not attached)openprom (driver not attached) client-services (driver not attached)options, instance #0aliases (driver not attached)memory (driver not attached)virtual-me
23、mory (driver not attached)associations (driver not attached) slot2disk (driver not attached) slot2led (driver not attached) slot2dev (driver not attached)pci, instance #0 ebus, instance #0 auxio (driver not attached)# prtconf DSystem Configuration: Sun Microsystems sun4uMemory size: 1024 MegabytesSy
24、stem Peripherals (Software Nodes):SUNW,Ultra-4packages terminal-emulator deblocker obp-tftp disk-label SUNW,builtin-drivers sun-keyboard ufs-file-systemchosenopenprom client-servicesoptions, instance #0 (driver name: options)aliasesmemoryvirtual-memoryassociations slot2disk slot2led slot2devpci, ins
25、tance #0 (driver name: pcipsy) ebus, instance #0 (driver name: ebus) auxio power (driver name: power) SUNW,pll sc se, instance #0 (driver name: se)su, instance #0 (driver name: su).13)查看当前系统中已经应用的补丁# showrev pPatch: 109618-01 Obsoletes: Requires: Incompatibles: Packages: SUNWeuxwe,SUNWeuezt, SUNWeud
26、lg, SUNWeuddaPatch: 109889-01 Obsoletes: 109353-04 Requires: Incompatibles: Packages:SUNWkvmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlxPatch: 110369-05 Obsoletes: 110709-02 Requires: Incompatibles: Packages:SUNWkvmx, SUNWcarx, SUNWcsrPatch: 110370-03 Obsoletes: 111643-01 Requires: Incompatible
27、s: Packages:SUNWkvmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlxPatch: 110373-04 Obsoletes: 111508-01 Requires: Incompatibles: Packages:SUNWkvmx, SUNWcarx, SUNWcsrPatch: 110374-08 Obsoletes: 110136-02, 110516-02 Requires: Incompatibles:Packages: SUNWkvmx, SUNWcarx, SUNWcar, SUNWcsr, SUNWmdbx.14)
28、显示当前的运行级别# who rHNAME LINE TIME IDLE PID COMMENTS. run-level 3 Nov 24 10:18 3 0 S15)查找一个文件所从属的包# pkgchk lp /usr/lib/sendmailPathname: /usr/lib/sendmailType: regular fileExpected mode: 4555Expected owner: rootExpected group: binExpected file size (bytes): 761368Expected sum(1) of contents: 41707Expec
29、ted last modification: Sep 24 03:13:13 2001Referenced by the following packages: SUNWsndmuCurrent status: installed16)查看当前的bind版本信息# nslookup class=chaos q=txt version.bindServer: Address: 88,声卡信息-1)lspci|grep-iVGA2)dmesg|grep-iVGA-Solaris 与硬件相关的命令1查看当前处理器的类型和速度(主频) # psrinfo v Status of processor 1
30、 as of: 11/24/01 10:34:41 Processor has been on-line since 11/24/01 10:18:20. The sparcv9 processor operates at 432 MHz, and has a sparcv9 floating point processor. Status of processor 3 as of: 11/24/01 10:34:41 Processor has been on-line since 11/24/01 10:18:22. The sparcv9 processor operates at 43
31、2 MHz, and has a sparcv9 floating point processor. 2打印当前的OBP版本号 # prtconf V OBP 3.20.0 2000/10/24 10:47 # /usr/platform/sun4u/sbin/prtdiag v | grep OBP OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49 ok. .version Release 3.20 Version 0 created 2000/10/24 10:47 OBP 3.20.0 2000/10/24 10:47 POS
32、T 6.1.0 2000/10/24 10:49 OBDIAG 4.5.1 2000/10/24 10:48 3查看硬盘物理信息(vendor, RPM, Capacity) # iostat E sd0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: SEAGATEProduct: ST34371W SUN4.2G Revision: 7462 Serial No: JDX394220KW EBC Size: 4.29GBMedia Error: 0 Device Not Ready: 0 No Device: 0 Reco
33、verable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd2 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: FUJITSUProduct: MAJ3364M SUN36GRevision: 0804 Serial No: 01M18144 Size: 36.42GBMedia Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failu
34、re Analysis: 0 sd3 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Vendor: FUJITSUProduct: MAJ3364M SUN36GRevision: 0804 Serial No: 01M16199 Size: 36.42GBMedia Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 sd21 Soft Errors: 0 Hard Errors
35、: 0 Transport Errors: 0 Vendor: TOSHIBAProduct: DVD-ROM SD-M1401 Revision: 1007 Serial No: 06/22/00 Size:71GBMedia Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0 Predictive Failure Analysis: 0 4查看磁盘的几何参数和分区信息 # prtvtoc /dev/rdsk/c0t0d0s0 * /dev/rdsk/c0t0d0s0
36、 partition map * * Dimensions: * 512 bytes/sector * 135 sectors/track * 16 tracks/cylinder * 2160 sectors/cylinder * 3882 cylinders * 3880 accessible cylinders * * Flags: * 1: unmountable *10: read-only * * Unallocated space: * First Sector Last * Sector Count Sector * 8277120 103680 8380799 * * Fir
37、st Sector Last * PartitionTagFlags Sector Count Sector Mount Directory 0 2 00 0 2049840 2049839 / 1 3 01 2049840 615600 2665439 2 5 00 0 8380800 8380799 5 0 00 2665440 2458080 5123519 /opt 6 4 00 5123520 3073680 8197199 /usr 7 8 00 8197200 79920 8277119 /export/home 5显示已经使用和未使用的i-node数目 # df F ufs o
38、 i Filesystem iused ifree%iusedMounted on /dev/dsk/c0t0d0s0 7859479821 2% / /dev/dsk/c0t0d0s6 37763339517 10% /usr /dev/dsk/c0t0d0s5 722301102 0% /opt /dev/dsk/c0t0d0s7 4 24380 0% /export/home 6.显示cpu使用率最高的进程 # ps eo pid,pcpu,args | sort +1n 该命令输出当前系统进程的pid, CPU占用率及命令描述,并以pcpu来排序 7显示内存占用率最高的进程 # ps
39、eo pid,vsz,args | sort +1n 该命令输出当前系统进程的pid,内存占用率及命令描述,并以vsz来排序 8查看及启动系统的32位或64位内核模式 64位模式 # isalist v sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc # isainfo v 64-bit sparcv9 applications 32-bit sparc applications # isainfo b 64 启动64位内核模式 ok. boot kernel/sparcv
40、9/unix 32位模式 # isalist v sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc # isainfo v 32-bit sparc applications # isainfo b 32 启动32位模式 ok. boot kernel/unix 9查看当前的OpenWindows版本 # showrev w OpenWindows version: X11 Version 6.4.15 November 2001 10查看当前CDE的版本 # /usr/ccs/bin/what /usr/dt/b
41、in/dtmail /usr/dt/bin/dtmail: CDE Version 1.4.6_06 CDEVersion1.4.6_06 11测定当前的显示器刷新频率 /usr/sbin/ffbconfig rev ? Valid values for -res option are: 1024x768x60 1 1024x768x70 1 1024x768x75 1 2 1024x768x77 1024x800 x84 1152x900 x66 1152x900 x76 1280 x800 x76 1 2 1280 x1024x60 1 2 1280 x1024x67 1280 x1024
42、x76 1280 x1024x85 1 2 960 x680 x112s 960 x680 x108s 640 x480 x60 1 2 640 x480 x60i 1 768x575x50i 1 1440 x900 x76 1 2 1600 x1000 x66 1 2 1600 x1000 x76 1 2 1600 x1280 x76 1 2 1920 x1080 x72 1 2 1920 x1080 x76 1 2 1920 x1200 x70 1 2 1920 x1200 x75 1 2 svga 1 1152 1280 stereo vga 1 2 ntsc 1 pal 1 none
43、Notes: 1 monitor does not support this resolution. 2 this version of FFB (FFB1) does not support this resolution 12查看系统配置 # /usr/platform/sun4u/sbin/prtdiag v System Configuration:Sun Microsystemssun4u Sun Enterprise 450 (2 X UltraSPAR C-II 432MHz) System clock frequency: 86 MHz Memory size: 1024 Me
44、gabytes = CPUs = Run Ecache CPU CPU BrdCPU Module MHz MB Impl. Mask -More- - SYS 1 1 432 4.0 US-II 10.0 SYS 3 3 432 4.0 US-II 10.0 = Memory = Interlv.Socket Size Bank Group Name (MB)Status - - - - 0 none 1901 256 OK 0 none 1902 256 OK 0 none 1903 256 OK 0 none 1904 256 OK 0 none 1701 256 OK 0 none 1
45、702 256 OK = IO Cards = No failures found in System = = Environmental Status = System Temperatures (Celsius): - AMBIENT 20 CPU 1 40 CPU 3 40 = Front Status Panel: - Keyswitch position is in On mode. System LED Status: POWER GENERAL ERROR ACTIVITY ON OFF ON DISK ERRORTHERMAL ERRORPOWER SUPPLY ERROR O
46、FF OFF OFF Disk LED Status: OK = GREEN ERROR = YELLOW DISK2: OK DISK3: OK DISK0: OK DISK1: EMPTY = Fans: - Fan Bank Speed Status - - - CPU 49 OK PWR 31 OK Power Supplies: - Supply Rating Temp Status - - - - 0 550 W 33 OK 1 550 W 33 OK = HW Revisions = ASIC Revisions: - STP2223BGA: Rev 4 STP2223BGA:
47、Rev 4 STP2223BGA: Rev 4 STP2003QFP: Rev 1 STP2205BGA: Rev 1 System PROM revisions: - OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49 # sysdef * * Hostid * 80fee99b * * sun4u Configuration * * * Devices * packages (driver not attached) terminal-emulator (driver not attached) deblocker (driver
48、 not attached) obp-tftp (driver not attached) disk-label (driver not attached) SUNW,builtin-drivers (driver not attached) sun-keyboard (driver not attached) ufs-file-system (driver not attached) chosen (driver not attached) openprom (driver not attached) client-services (driver not attached) options
49、, instance #0 aliases (driver not attached) memory (driver not attached) virtual-memory (driver not attached) associations (driver not attached) slot2disk (driver not attached) slot2led (driver not attached) slot2dev (driver not attached) pci, instance #0 ebus, instance #0 auxio (driver not attached
50、) # prtconf D System Configuration:Sun Microsystemssun4u Memory size: 1024 Megabytes System Peripherals (Software Nodes): SUNW,Ultra-4 packages terminal-emulator deblocker obp-tftp disk-label SUNW,builtin-drivers sun-keyboard ufs-file-system chosen openprom client-services options, instance #0 (driv
51、er name: options) aliases memory virtual-memory associations slot2disk slot2led slot2dev pci, instance #0 (driver name: pcipsy) ebus, instance #0 (driver name: ebus) auxio power (driver name: power) SUNW,pll sc se, instance #0 (driver name: se) su, instance #0 (driver name: su) . 13查看当前系统中已经应用的补丁 #
52、showrev p Patch: 109618-01 Obsoletes:Requires:Incompatibles:Packages: SUNWeuxwe, SUN Weuezt, SUNWeudlg, SUNWeudda Patch: 109889-01 Obsoletes: 109353-04 Requires:Incompatibles:Packages: SUNWk vmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlx Patch: 110369-05 Obsoletes: 110709-02 Requires:Incompatib
53、les:Packages: SUNWk vmx, SUNWcarx, SUNWcsr Patch: 110370-03 Obsoletes: 111643-01 Requires:Incompatibles:Packages: SUNWk vmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlx Patch: 110373-04 Obsoletes: 111508-01 Requires:Incompatibles:Packages: SUNWk vmx, SUNWcarx, SUNWcsr Patch: 110374-08 Obsoletes:
54、110136-02, 110516-02 Requires:Incompatibles:Pack ages: SUNWkvmx, SUNWcarx, SUNWcar, SUNWcsr, SUNWmdbx . 14显示当前的运行级别 # who rH NAME LINE TIME IDLE PIDCOMMENTS . run-level 3Nov 24 10:18 3 0S 15查找一个文件所从属的包 # pkgchk lp /usr/lib/sendmail Pathname: /usr/lib/sendmail Type: regular file Expected mode: 4555 E
55、xpected owner: root Expected group: bin Expected file size (bytes): 761368 Expected sum(1) of contents: 41707 Expected last modification: Sep 24 03:13:13 2001 Referenced by the following packages: SUNWsndmu Current status: installed 16查看当前的bind版本信息 # nslookup class=chaos q=txt version.bind Server: A
56、ddress:8 version.bind text = 9.2.1查看Solaris的内存/usr/platform/sun4u/sbin/prtdiag 2) wsinfo 3) /usr/sbin/prtconf | grep -i memory附录资料:不需要的可以自行删除 libxml2应用实例Libxml2 是一个xml的c语言版的解析器,本来是为Gnome项目开发的工具,是一个基于MIT License的免费开源软件。它除了支持c语言版以外,还支持c+、PHP、Pascal、Ruby、Tcl等语言的绑定,能在Windows、Linux、Solaris、MacOsX等平台上运行。功
57、能还是相当强大的,相信满足一般用户需求没有任何问题。二、 Libxml2安装:一般如果在安装系统的时候选中了所有开发库和开发工具的话(Fedora Core系列下),应该不用安装,下面介绍一下手动安装: 1) 从xmlsoft站点或ftp()站点下载libxml压缩包(libxml2-xxxx.tar.gz)2) 对压缩包进行解压缩 tar xvzf libxml2-xxxx.tar.gz3) 进入解压缩后的文件夹中运行 ./configure -prefix /home/user/myxml/xmlinst(此处为待安装的路径)或者直接使用 ./configure make make ins
58、tall 4) 添加路径 export PATH=/home/user/myxml/xmlinst/bin:$PATH 说明:为了结构清晰,最好将libxml2不安装在解压目录中。安装完成后就可以使用简单的代码解析XML文件,包括本地和远程的文件,但是在编码上有一些问题。Libxml默认只支持UTF8的编码,无论输入输出都是UTF-8,所以如果你解析完一个XML得到的结果都是UTF8的,如果需要输出GB2312或者其它编码,需要ICONV来做转码(生成UTF8编码的文件也可以用它做),如果系统中没有安装iconv的话,需要安装libiconv。 1) 下载libiconv压缩包(例如libic
59、onv-1.11.tar.gz) 2) 对压缩包进行解压缩tar xvzf libiconv-1.11.tar.gz 3) 进入解压缩后的文件夹中运行 ./configure make make install三、关于XML:在开始研究 Libxml2 库之前,先了解一下XML的相关基础。XML 是一种基于文本的格式,它可用来创建能够通过各种语言和平台访问的结构化数据。它包括一系列类似 HTML 的标记,并以树型结构来对这些标记进行排列。例如,可参见清单 1 中介绍的简单文档。为了更清楚地显示 XML 的一般概念,下面是一个简化的XML文件。清单 1. 一个简单的 XML 文件 root de
60、lete 10清单 1 中的第一行是 XML 声明,它告诉负责处理 XML 的应用程序,即解析器,将要处理的 XML 的版本。大部分的文件使用版本 1.0 编写,但也有少量的版本 1.1 的文件。它还定义了所使用的编码。大部分文件使用 UTF-8,但是,XML 设计用来集成各种语言中的数据,包括那些不使用英语字母的语言。接下来出现的是元素。一个元素以开始标记 开始(如 ),并以结束标记 结束(如 ),其中使用斜线 (/) 来区别于开始标记。元素是 Node 的一种类型。XML 文档对象模型 (DOM) 定义了几种不同的 Nodes 类型,包括:Elements(如 files 或者 age)A
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年湖南省衡阳市地理生物会考真题试卷(含答案)
- 2025年广东省中山市初二地生会考试题题库(答案+解析)
- 给就业指导课老师的建议
- 疫情后时代劳动合同调整与应对策略
- 深圳劳动合同法解读及范本下载
- 2026年劳动合同续签合同范本
- 2026年物业服务合同模板大全
- 2026年纪委书记个人思想总结报告怎么写(2篇)
- 2026公司自查报告(3篇)
- 妊娠剧吐的孕期孕期饮食管理
- ISO9001:2015培训教材课件
- 2024年犬伤门诊预防接种知识考核试题及答案
- 新生儿早期基本保健指南课件
- 变频器工作原理与及应用
- 工程罚款通知单模版
- 毕业设计(论文)-zpw-2000a型区间移频自动闭塞系统工程毕业设计管理资料
- 污染土壤修复技术课件
- 珍爱生命,远离网瘾-网络安全教育主题班会
- GB/T 20080-2017液压滤芯技术条件
- 浙江英语中考作文范文10篇
- 安全评价机构信息公开表
评论
0/150
提交评论