1.example.xml--メインデータファイル
<?xml version="1.0" encoding="UTF-8"?> <?xml:stylesheet type="text/xsl" href="example.xsl"?> <projects id="1"> <project title="一级标题1" index="1"> <items isTrunk="false" title="二级标题1.1" id="items_1"> <result type="2">1</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> <remark></remark> </items> <items isTrunk="false" title="二级标题1.2" id="items_2"> <result type="2">3</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </items> </project> <project title="一级标题2" index="2"> <items isTrunk="false" title="二级标题2.1" id="items_3"> <result type="3">3</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </items> <items isTrunk="true" title="二级标题2.2"> <item title="三级标题2.2.1" id="item_1"> <result type="1">2</result> <officer><![CDATA[居然是乱码]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> <item title="三级标题2.2.2" id="item_2"> <result type="1">3</result> <officer><![CDATA[<><>]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> </items> <items isTrunk="true" title="二级标题2.3"> <item title="三级标题2.3.1" id="item_3"> <result type="2">1</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> <item title="三级标题2.3.2" id="item_4"> <result type="2">1</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> </items> </project> <project title="一级标题3" index="3"> <items isTrunk="false" title="二级标题3.1" id="items_4"> <result type="4" units="元">25345</result> <officer><![CDATA[sinoly]]></officer> <classified>1</classified> <eligibility>0</eligibility> </items> <items isTrunk="false" title="二级标题3.2" id="items_5"> <result type="4" units="元">9865764</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </items> <items isTrunk="false" title="二级标题3.3" id="items_6"> <result type="2">0</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </items> <items isTrunk="true" title="二级标题3.4"> <item title="三级标题3.4.1" id="item_5"> <result type="1">0</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> <item title="三级标题3.4.2" id="item_6"> <result type="1">0</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> <item title="三级标题3.4.3" id="item_7"> <result type="1">0</result> <officer><![CDATA[]]></officer> <classified>1</classified> <eligibility>0</eligibility> </item> </items> </project> </projects>
2.example.xsl--スタイルファイル、XMLデータを取得するのに非常に便利です
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!--根模板--> <xsl:output method="xml"/> <xsl:template match="/"> <xsl:apply-templates select="projects/project"/> <h6> <button type="submit" class="btn1_mouseout" onmouseover="this.className='btn1_mouseover'" onmouseout="this.className='btn1_mouseout'" title="提交"> 下一步</button> </h6> </xsl:template> <!--主题模板--> <xsl:template match="project"> <TABLE border="0" cellspacing="0" cellpadding="0" class="table"> <tr> <td colspan="5" align="center" class="tright"> <h2> <xsl:number value="position()" format="一、"/><xsl:value-of select="@title"/> </h2> </td> </tr> <xsl:apply-templates select="items"/> </TABLE> <BR/> </xsl:template> <!--一级题干模板--> <xsl:template match="items"> <tr> <td colspan="2" class="tright"> <xsl:number value="position()" format="1."/><xsl:value-of select="@title"/> </td> <xsl:choose> <xsl:when test="@isTrunk[.='false']"> <xsl:apply-templates select="result"/> <xsl:apply-templates select="officer"/> </xsl:when> <xsl:otherwise> <td colspan="3" class="tright" style="color:blue;font-weight:bolder"> 注意以下几点 </td> <xsl:apply-templates select="item"/> </xsl:otherwise> </xsl:choose> </tr> </xsl:template> <!--二级题干模板--> <xsl:template match="item"> <tr> <td class="tright" style="padding-left:20px" colspan="2"> <h4><xsl:number value="position()" format="(a)."/><xsl:value-of select="@title"/></h4> </td> <xsl:apply-templates select="result"/> <xsl:apply-templates select="officer"/> </tr> </xsl:template> <!--选择框模板--> <xsl:template match="result"> <xsl:choose> <xsl:when test="@type = '1'"> <td width="15%"> <xsl:element name="select"> <xsl:attribute name="name">re_<xsl:value-of select="../@id"/></xsl:attribute> <!--<select name="select">--> <xsl:choose> <xsl:when test=".='0'"> <option value="0" selected="selected">请选择 </option> <option value="1">符合</option> <option value="2">基本符合</option> <option value="3">不符合</option> </xsl:when> <xsl:when test=".='1'"> <option value="0">请选择 </option> <option value="1" selected="selected">符合</option> <option value="2">基本符合</option> <option value="3">不符合</option> </xsl:when> <xsl:when test=".='2'"> <option value="0">请选择 </option> <option value="1">符合</option> <option value="2" selected="selected">基本符合</option> <option value="3">不符合</option> </xsl:when> <xsl:when test=".='3'"> <option value="0">请选择 </option> <option value="1">符合</option> <option value="2">基本符合</option> <option value="3" selected="selected">不符合</option> </xsl:when> </xsl:choose> <!--</select>--> </xsl:element> </td> </xsl:when> <xsl:when test="@type = '2'"> <td width="15%"> <xsl:element name="select"> <xsl:attribute name="name">re_<xsl:value-of select="../@id"/></xsl:attribute> <xsl:choose> <xsl:when test=".='0'"> <option value="0" selected="selected">请选择 </option> <option value="1">是</option> <option value="2">否</option> </xsl:when> <xsl:when test=".='1'"> <option value="0">请选择 </option> <option value="1" selected="selected">是</option> <option value="2">否</option> </xsl:when> <xsl:when test=".='3'"> <option value="0">请选择 </option> <option value="1">是</option> <option value="2" selected="selected">否</option> </xsl:when> </xsl:choose> </xsl:element> </td> </xsl:when> <xsl:when test="@type = '3'"> <td width="15%"> <xsl:element name="select"> <xsl:attribute name="name">re_<xsl:value-of select="../@id"/></xsl:attribute> <xsl:choose> <xsl:when test=".='0'"> <option value="0" selected="selected">请选择 </option> <option value="1">有</option> <option value="2">无</option> </xsl:when> <xsl:when test=".='1'"> <option value="0">请选择 </option> <option value="1" selected="selected">有</option> <option value="2">无</option> </xsl:when> <xsl:when test=".='3'"> <option value="0">请选择 </option> <option value="1">有</option> <option value="2" selected="selected">无</option> </xsl:when> </xsl:choose> </xsl:element> </td> </xsl:when> <xsl:otherwise> <td width="15%"> <xsl:element name="textarea"> <xsl:attribute name="name">re_<xsl:value-of select="../@id"/></xsl:attribute><xsl:value-of select="."/> </xsl:element> <xsl:value-of select="@units"/> </td> </xsl:otherwise> </xsl:choose> </xsl:template> <!--责任人模板--> <xsl:template match="officer"> <td width="9%" class="tright">责任人</td> <td width="11%"> <xsl:element name="textarea"> <xsl:attribute name="name">of_<xsl:value-of select="../@id"/></xsl:attribute> <xsl:value-of select="."/> </xsl:element> </td> </xsl:template> </xsl:stylesheet>
現在のページ 1/2 12 1 ページで全文をお読みください
以上がJavaScript xml xslによる値の取得とデータ変更の例を1/2ページで詳しく説明の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

RSSとXMLは、ネットワークコンテンツの分布とデータ交換のコアテクノロジーです。 RSSは頻繁に更新されるコンテンツを公開するために使用され、XMLはデータの保存と転送に使用されます。開発効率とパフォーマンスは、実際のプロジェクトでの使用例とベストプラクティスを通じて改善できます。

RSSFeedにおけるXMLの役割は、データを構成し、標準化し、スケーラビリティを提供することです。 1.xmlはRSSFeedデータを構造化するため、解析と処理が簡単になります。 2.xmlは、RSSFeedの形式を定義する標準化された方法を提供します。 3.XMLスケーラビリティにより、RSSFeedは必要に応じて新しいタグと属性を追加できます。

XMLおよびRSSデータを処理する場合、次の手順でパフォーマンスを最適化できます。1)LXMLなどの効率的なパーサーを使用して、解析速度を改善します。 2)SAXパーサーを使用して、メモリの使用量を削減します。 3)Xpath式を使用して、データ抽出効率を改善します。 4)処理速度を改善するために、マルチプロセスの並列処理を実装します。

RSS2.0は、コンテンツパブリッシャーが構造化された方法でコンテンツを配布できるようにするオープン標準です。タイトル、リンク、説明、リリース日などの豊富なメタデータが含まれているため、サブスクライバーは迅速にコンテンツを参照してアクセスできます。 RSS2.0の利点は、そのシンプルさとスケーラビリティです。たとえば、カスタム要素を許可します。つまり、開発者は著者、カテゴリなどのニーズに基づいて追加情報を追加できます。

RSSは、頻繁に更新されるコンテンツを公開するために使用されるXMLベースの形式です。 1。RSSFeedは、タイトル、リンク、説明などを含むXML構造を通じて情報を整理します。2。rssfeedの作成には、言語やリリース日などのメタデータを追加するXML構造での書き込みが必要です。 3.高度な使用法には、マルチメディアファイルと分類された情報を含めることができます。 4.デバッグ中にXML検証ツールを使用して、必要な要素が存在し、正しくエンコードされていることを確認します。 5. RSSFeedの最適化は、構造をシンプルに保つことで、ページング、キャッシュ、および保持することで実現できます。この知識を理解して適用することにより、コンテンツを効果的に管理および配布できます。

RSSは、コンテンツを公開および購読するために使用されるXMLベースの形式です。 RSSファイルのXML構造には、ルート要素、要素、および複数の要素が含まれ、それぞれがコンテンツエントリを表します。 XMLパーサーを介してRSSファイルを読み取り、解析すると、ユーザーは最新のコンテンツを購読して取得できます。

XMLには、RSSの構造化データ、スケーラビリティ、クロスプラットフォームの互換性、解析検証の利点があります。 1)構造化されたデータにより、コンテンツの一貫性と信頼性が保証されます。 2)スケーラビリティにより、コンテンツのニーズに合わせてカスタムタグを追加できます。 3)クロスプラットフォームの互換性により、さまざまなデバイスでシームレスに動作します。 4)分析および検証ツールは、フィードの品質と完全性を確保します。

XMLでのRSSの実装は、構造化されたXML形式を使用してコンテンツを整理することです。 1)RSSは、チャネル情報やプロジェクトリストなどの要素を含むデータ交換形式としてXMLを使用します。 2)RSSファイルを生成する場合、コンテンツは仕様に従って整理し、サブスクリプションのためにサーバーに公開する必要があります。 3)RSSファイルは、読者またはプラグインを介してサブスクライブして、コンテンツを自動的に更新できます。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

SublimeText3 中国語版
中国語版、とても使いやすい

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

Safe Exam Browser
Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

ホットトピック









