Skip to main content

XsdComponent

Struct XsdComponent 

Source
pub struct XsdComponent {
Show 19 fields pub component_type: XsdComponentType, pub name: Option<String>, pub target_namespace: Option<String>, pub children: Vec<XsdComponent>, pub attributes: Vec<XsdComponent>, pub datatype: Option<XsdDatatypeKind>, pub facets: Vec<(XsdDatatypeKind, String)>, pub base: Option<String>, pub min_occurs: i32, pub max_occurs: i32, pub ref_name: Option<String>, pub substitution_group: Option<String>, pub is_abstract: bool, pub is_final: bool, pub block: Vec<String>, pub mixed: bool, pub form: Option<String>, pub default_value: Option<String>, pub fixed_value: Option<String>,
}
Expand description

An XSD schema component declaration.

Represents any XSD component (element, attribute, type, model group, etc.). Components form a tree via the children and attributes vectors.

Fields§

§component_type: XsdComponentType

The kind of XSD component this declaration represents.

§name: Option<String>

The component’s local name (from the name attribute); None for anonymous components.

§target_namespace: Option<String>

The namespace the component is declared in.

§children: Vec<XsdComponent>

Child components — model group children, inline type definitions, etc.

§attributes: Vec<XsdComponent>

Attribute declarations belonging to this component (complex types).

§datatype: Option<XsdDatatypeKind>

The resolved built-in datatype kind, when the component is typed with a built-in XSD type.

§facets: Vec<(XsdDatatypeKind, String)>

Facets constraining the type, stored as (facet kind, facet value) pairs.

§base: Option<String>

The base type of a derived type (restriction/extension/list/union), or the unresolved type name for elements/attributes with a named type.

§min_occurs: i32

Minimum occurrence count (default 1; 0 for optional). Also reused for the use attribute of attribute declarations.

§max_occurs: i32

Maximum occurrence count; -1 for unbounded.

§ref_name: Option<String>

For references: the name of the referenced element/attribute (from the ref attribute).

§substitution_group: Option<String>

The name of the substitution group this element belongs to.

§is_abstract: bool

Whether the component is declared abstract (cannot be used directly).

§is_final: bool

Whether the component is declared final (cannot be derived from).

§block: Vec<String>

The block attribute: derivation methods disallowed for the type.

§mixed: bool

Whether the type allows mixed element content (xs:complexType mixed).

§form: Option<String>

The form attribute (qualified/unqualified) for this component, overriding the schema’s elementFormDefault/attributeFormDefault.

§default_value: Option<String>

The default value of an element/attribute declaration. Elements with a simple type default their text content; attributes that are absent from an instance get this value injected under XML_SCHEMA_VAL_VC_I_CREATE (LIBXML_SCHEMA_CREATE).

§fixed_value: Option<String>

The fixed value of an element/attribute declaration (absent attributes are created with it; present values must equal it).

Implementations§

Source§

impl XsdComponent

Source

pub const fn new(component_type: XsdComponentType) -> Self

Create a new component with the given type and default field values.

Defaults: min_occurs = 1, max_occurs = 1, all optional fields None.

Trait Implementations§

Source§

impl Clone for XsdComponent

Source§

fn clone(&self) -> XsdComponent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for XsdComponent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.