pub struct XmlValue {
pub type_code: XmlTypeCode,
pub schema_type: Option<SimpleTypeKey>,
pub value: XmlValueKind,
}Expand description
A typed XSD value with type information.
This is the primary value type for XPath2/XQuery operations. It carries both the value and its type information.
Fields§
§type_code: XmlTypeCodeThe type code identifying the value’s type
schema_type: Option<SimpleTypeKey>Optional reference to a schema-defined type
value: XmlValueKindThe actual value
Implementations§
Source§impl XmlValue
impl XmlValue
Sourcepub fn new(type_code: XmlTypeCode, value: XmlValueKind) -> Self
pub fn new(type_code: XmlTypeCode, value: XmlValueKind) -> Self
Create a new XmlValue with the given type code and value
Sourcepub fn with_schema_type(
type_code: XmlTypeCode,
schema_type: SimpleTypeKey,
value: XmlValueKind,
) -> Self
pub fn with_schema_type( type_code: XmlTypeCode, schema_type: SimpleTypeKey, value: XmlValueKind, ) -> Self
Create a new XmlValue with schema type reference
Sourcepub fn is_untyped(&self) -> bool
pub fn is_untyped(&self) -> bool
Check if this is an untyped atomic value
Sourcepub fn primitive_type(&self) -> Option<PrimitiveTypeCode>
pub fn primitive_type(&self) -> Option<PrimitiveTypeCode>
Get the primitive type code for this value
Sourcepub fn to_string_value(&self) -> String
pub fn to_string_value(&self) -> String
Get the string value (canonical representation)
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Try to get as boolean
Sourcepub fn as_decimal(&self) -> Option<Decimal>
pub fn as_decimal(&self) -> Option<Decimal>
Try to get as decimal
Sourcepub fn as_integer(&self) -> Option<&BigInt>
pub fn as_integer(&self) -> Option<&BigInt>
Try to get as integer
Sourcepub fn as_qname(&self) -> Option<&QualifiedName>
pub fn as_qname(&self) -> Option<&QualifiedName>
Try to get as QName
Sourcepub fn to_xpath_value<N: DomNavigator>(
&self,
item_schema_type: Option<SimpleTypeKey>,
) -> XPathValue<N>
pub fn to_xpath_value<N: DomNavigator>( &self, item_schema_type: Option<SimpleTypeKey>, ) -> XPathValue<N>
Convert this XmlValue to an XPathValue for use as $value in assertion evaluation.
- Atomic/UntypedAtomic → single
XPathValue::Item - List →
XPathValue::Sequenceof atomic items, each withitem_schema_type - Union → recursively converts the inner value
The item_schema_type parameter is needed because XmlValueKind::List stores bare
XmlAtomicValue items without per-item schema_type. Callers pass it from the
list type’s resolved_item_type.