freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

精品課件教案ppt】第二十章可擴(kuò)展標(biāo)記語言xml(留存版)

2025-02-26 15:40上一頁面

下一頁面
  

【正文】 reeViewerRefresh()。 } // end catch // catch empty exception catch( XPathException^ ) { MessageBox::Show( LPlease select an expression, LError, MessageBoxButtons::OK, MessageBoxIcon::Error )。解析 器需要附加的功能才能識(shí)別 EBNF 語法,因?yàn)樗⒉皇? XML 語 法。 必須替換 成它們的 ? 實(shí)體引用 ?(即 amp。 下面是一個(gè)遵循了 ( DTD) 的 XML 文檔 。 注意,語法沒有提供任何機(jī)制來描述一個(gè)元素(或?qū)傩裕┑? 數(shù)據(jù)類型。顯然, ? 有效 ? 的 XML 文檔肯定是一個(gè) ? 良構(gòu) ? 的 XML 文檔。代碼如下: System::Void selectButton_Click( System::Object^ sender, System::EventArgs^ e) { XPathNodeIterator ^iterator。 // create new node DetermineType( newNode, xpath )。s name or value DetermineType( newTreeNode, xpath )。 ② 用于導(dǎo)航瀏覽 document 中的 XML 數(shù)據(jù)的 XPathNavigator^ 類 型數(shù)據(jù)成員: private: XPathNavigator ^xpath 。 XPath 是一種基 于字符串的表達(dá)式語言,供 XML 及其許多相關(guān)技術(shù)使用。 // read, format and display data while( readerRead() ) { if( readerNodeType == XmlNodeType::EndElement ) consoleTextBoxAppendText( L/ )。 } // end else break。 // build tree based on node type switch( nodeReaderNodeType ) { // if Text node, add its value to tree case XmlNodeType::Text: newNodeText = nodeReaderValue。代碼如下: System::Void buildButton_Click( System::Object^ sender, System::EventArgs^ e) { // determine if copy has been built already if( copy != nullptr ) return。 程序的 GUI 設(shè)計(jì)如下: 其中添加的三個(gè)按鈕( Button)控件、一個(gè)樹形視圖( TreeView) 控件和一個(gè)文本框控件( TextBox)的用途如下: 控件標(biāo)題 控件對(duì)象名 用途 Build buildButton 發(fā)出復(fù)制源 XML 文件對(duì)象到目標(biāo) XML 文件對(duì) 象,并創(chuàng)建顯示數(shù)據(jù)的樹形視圖的命令事件。 break。 // show form before outputTextBox is populated thisShow()。 節(jié)點(diǎn)的 ? 后輩節(jié)點(diǎn) ?( Descendant Node)包括:節(jié)點(diǎn)的子節(jié)點(diǎn)、 子節(jié)點(diǎn)的子節(jié)點(diǎn) … 類似地, 節(jié)點(diǎn)的 ? 前輩節(jié)點(diǎn) ?( Ancestor Node)包括:節(jié)點(diǎn)的父節(jié)點(diǎn)、父 節(jié)點(diǎn)的父節(jié)點(diǎn) … 每個(gè) DOM 樹都只有一個(gè) ? 根節(jié)點(diǎn) ?,它包含了其他所有節(jié)點(diǎn)、 比如注解和元素。這些 URL 不需要引用實(shí)際的網(wǎng) 頁,甚至不需要具有正確的形式。除了保留的命名空間前綴 xml 之外,文檔作者 可將任何名稱作為命名空間前綴使用。 salutation 元素標(biāo)記了信 函問候語。該解析器負(fù)責(zé) 檢查 XML 文檔的語法,并使 XML 文檔的數(shù)據(jù)能由應(yīng)用程序使用。標(biāo)記必須成對(duì)使用,以便對(duì)字符數(shù)據(jù)進(jìn)行定界。 XML 是 可移植的、獲得普遍支持的開放(非專利性)技術(shù),可以用于 對(duì)數(shù)據(jù)進(jìn)行描述。 XML 正在快速成為程序的數(shù)據(jù)交換標(biāo)準(zhǔn)。例如: titleSimle XML/title。 流行的解析器包括微軟的 MSXML、 Apache 軟件基金會(huì)的 Xerces 以及 IBM 的 XML4J 等等。 paragraph 元素標(biāo)記了信函正文。 注意,以任何大小寫組合形式創(chuàng)建名為 xml 的命名空間前綴都 是語法錯(cuò)誤。 第 9~11 行用命名空間前綴 text 來限定元素 file 和 description, 表示它們從屬于 ? urn:deitel:textInfo‖ 命名空間。 用于創(chuàng)建、讀取和操縱 XML 文檔的類型定義在 System::Xml 命 域空間中。 // tree depth is 1, no indentation int depth = 1。 // if EndElement, display it and decrement depth case XmlNodeType::EndElement: TabOutput( depth )。 Print printButton 發(fā)出將目標(biāo) XML 文件對(duì)象中數(shù)據(jù)以非樹形格 式顯示,并寫入新建 XML 文件的命令事件。 // document already exists // instantiate XmlDocument and TreeNode copy = gew XmlDocument()。 treeNodeNodesAdd( newNode )。 // all other types, display node type default: newNodeText = ((System::Object^) nodeReaderNodeType)ToString()。 if( readerName != String::Empty ) consoleTextBoxAppendText( String::Concat( readerName, L\r\n ))。 實(shí)例 3 PathNavigator 演示了如何使用 XPathNavigator 在 XML 文 檔中導(dǎo)航。 ③ 用于構(gòu)造樹形視圖的 TreeNode^ 類型數(shù)據(jù)成員: private: TreeNode ^tree 。 // add node to TreeNode node list treeNodesAdd( newTreeNode )。 newTreeNodeNodesAdd( newNode )。 // get specified node from ComboBox try { iterator = xpathSelect( selectComboBoxText )。如果文檔不 是 良構(gòu) 的,則會(huì)引起解析停止,解析器報(bào)錯(cuò)。 標(biāo)記 PCDATA 表明元素中可存儲(chǔ) ? 已解析字符數(shù)據(jù) ?(即文 本)。 1 ?xml version= encoding=utf8? 2 3 ! 4 ! Business letter formatted with XML 5 6 !DOCTYPE letter SYSTEM 7 8 letter 9 contact type =from 10 nameJane Doe/name 11 address1Box 12345/address1 12 address215 Any Ave./address2 13 cityOthertown/city 14 stateOtherstate/state 15 zip67890/zip 16 phone5554321/phone 17 flag gender =F / 18 /contact 19 20 contact type =to 21 nameJohn Doe/name 22 address1123 Main St./address1 23 address2/address2 24 cityAnytown/city 25 stateAnystate/state 26 zip12345/zip 27 phone5551234/phone 28 flag gender =M / 29 /contact 30 31 salutationDear Sir:/salutation 32 33 paragraphIt is 。字符 和 amp。使用擴(kuò)展的巴柯斯范式 EBNF ( Extended BackusNaur Form)語法來描述 XML 文檔內(nèi)容。 // print selection } // end try // catch invalid expressions catch( ArgumentException ^argumentException ) { MessageBox::Show( argumentExceptionMessage, LError, MessageBoxButtons::OK, MessageBoxIcon::Error )。 // update TreeView control pathTreeViewerExpandAll()。 // assign tree newTreeNode // update TreeView control pathTreeViewerExpandAll()。 // load in XML document document = gew XPathDocument( L )。兩實(shí)例的不同之處為: 本例在樹形視圖只顯示與當(dāng)前導(dǎo)航狀態(tài)相關(guān)的部分 DOM 樹。 } // end while readerClose()。 documentAppendChild( currentNode )。 documentAppendChild( currentNode )。 // add root node name to TreeNode and add TreeNode to // TreeView control treeText = sourceName。 xmlTreeView 樹形格式顯示源 XML 文件對(duì)象中的數(shù)據(jù)。 depth。s content while( readerRead() ) { switch( readerNodeType ) { // if Element, display its name case XmlNodeType::Element: // increase tab depth depth++。 文檔的 DOM 樹如下所示: 接下來,本節(jié)要展示使用 DOM 樹的幾個(gè)程序?qū)嵗5? 13~16 行將命名空間前綴 text 應(yīng)用 于 file、 description 和 size 元素。 1 ?xml version= encoding=utf8? 2 3 ! 4 ! Demonstrating namespaces. 5 6 text:directory xmlns:text =urn:deitel:textInfo 7 xmlns:image =urn:deitel:imageInfo 8 9 text:file filename = 10 text:descriptionA book list/text:description 11 /text:file 12 13 image:file filename = 14 imag
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1