[英]Differences in closing empty tags with XML
在XML中,兩者之間有區別嗎?
<mytag></mytag>
...和這個?
<mytag />
我知道后者較短,可能更慣用,但是它們的解析方式不同嗎?
兩種形式在語義上沒有區別。
它們在內存DOM中的表示方式完全相同,並且允許XML序列化程序為空元素輸出一個。 一些序列化程序提供了一個配置選項,使您可以選擇自己喜歡的形式。
埃文
它不會解析不同。
實際上,我同時擁有一種XML,着眼於ISBN和Model……很可能一個人有一個價值,現在已經沒有價值了。 該XML是通過.net序列化創建的。
<SKU PartNumber="3697">
<Product>6d690816-e06e-4a06-9205-97f0ee2f2500</Product>
<RealPrice>145.00</RealPrice>
<PromotionalPrice>145.00</PromotionalPrice>
<Stock>1000</Stock>
<FreeShipping>false</FreeShipping>
<Dimensions>
<Weight>0.50</Weight>
<Height>0</Height>
<Width>0</Width>
<Depth>0</Depth>
</Dimensions>
<SpecificFields>
<ISBN></ISBN>
<EAN13>9780139242182</EAN13>
<Model />
</SpecificFields>
<Variations />
<Code>00000000-0000-0000-0000-000000000000</Code>
<Status>true</Status>
<MinStock>0</MinStock>
<Default>true</Default>
</SKU>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.