簡體   English   中英

XML 使用 libxml2 的模式類型信息

[英]XML schema type information using libxml2

首先,我正在處理的應用程序使用 libxml2 來解析 XML 並根據模式驗證這個 XML,我不能使用另一個 XML 解析庫。

該模式包含 XML 中元素的類型信息,我正在嘗試獲取此類型信息但沒有成功。

示例架構:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="rootElement" type="xsd:integer"/>
</xsd:schema>

示例 XML

<rootElement>13</rootElement>

我想從 libxml2 獲得有關 rootElement 只能包含 integer 值的信息,如type="xsd:integer"位所規定的。

I'm most interested in the simple types, ie xsd:integer , xsd:string , xsd:double , xsd:boolean , etc. If an element is a complex type, the exact type is not important.

libxml2 API 根本不支持模式檢查,僅支持驗證。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM