Cov txheej txheem:

Cov cim dab tsi yuav tsum tau khiav hauv XML?
Cov cim dab tsi yuav tsum tau khiav hauv XML?

Video: Cov cim dab tsi yuav tsum tau khiav hauv XML?

Video: Cov cim dab tsi yuav tsum tau khiav hauv XML?
Video: Cov Ntseeg Yuav Tsum Ceev Faj - nkauj ntseeg tawm tshiab (N.Veejmee) (copyright ChichiaThao) 2023-24 2024, Hlis ntuj nqeg
Anonim

XML khiav tawm cov cim

Cov cim tshwj xeeb dim daim ntawv tau hloov los ntawm
Ampersand & &
Tsawg dua < <
Loj dua > >
Cov lus hais " "

Ib yam li ntawd, nws tau nug, cov cim dab tsi yuav tsum tau khiav hauv XML?

XML khiav cov cim Tsuas muaj tsib: "" ' ' > & Escaping cov cim nyob ntawm qhov tshwj xeeb tus cwj pwm yog siv. Cov piv txwv tuaj yeem raug lees paub ntawm W3C Markup Validation Service.

Ib yam li ntawd, dab tsi yog cov cim tshwj xeeb hauv XML? Siv Cov Cim Tshwj Xeeb hauv XML

Symbol (npe) Kev khiav tawm ib ntus
> (ntau tshaj) > los yog >
& (ampersand) &
' (apostrophe lossis ib nqe lus hais) '
"(ob-txoj kev) "

Cov lus nug tseem yog, koj ua li cas dhau cov cim tshwj xeeb hauv XML?

Cov cim tshwj xeeb hauv koj XML

  1. Siv UTF-8 editor lossis cov cuab yeej thaum tsim XML thiab ntxig cov cim ncaj qha rau hauv cov ntaub ntawv, uas ua rau ib lossis ntau byte ib ntu ntawm ib tus cim hauv cov ntaub ntawv. Piv txwv li, ib qho "S" nrog háček (Š) muaj tus lej lej ntawm 352 uas yog 160hex.
  2. Nkag mus rau tus cim tshwj xeeb siv tus lej sawv cev.

Puas yog Ampersand tso cai rau hauv XML?

Cov ampersand cim & yog tso cai tsuas yog thaum siv los khiav ib qho XML qhov chaw (los yog ib qho ntawm tsib lub ntsiab lus ua ntej XML Cov koom haum lossis ib lub koom haum uas tau tshaj tawm hauv Cov Ntaub Ntawv Hom Lus Txhais (DTD). Txij li thaum muaj kev lees paub siv rau ob lub cim no, lawv tsis hais lus nruj me ntsis txhaum cai XML cov cim.

Pom zoo: