#![allow(
non_snake_case,
clippy::all,
clippy::pedantic,
clippy::nursery,
unused_variables,
unused_mut,
unused_qualifications,
unused_imports,
reason = "mechanically generated codec text: every runtime item is named by its full path and every branch shape is emitted uniformly, so style and unused-binding lints do not apply — the hand-written runtime carries the lint bar"
)]
use crate::xml::runtime::{FromXml, ToXml, XmlError, XmlEvent};
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Operatorvaluetype {
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
_declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
w.write_text_element(tag, self.as_wire())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Operatorvaluetype {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let __s = <::std::string::String as crate::xml::runtime::FromXml>::from_xml(reader, start)?;
crate::aom2_model::types::Operatorvaluetype::from_wire(__s.trim()).map_err(|__e| {
crate::xml::runtime::XmlError::parse_source("element text of OperatorValueType", __e)
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ValidityKind {
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
_declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
w.write_text_element(tag, self.as_wire())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ValidityKind {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let __s = <::std::string::String as crate::xml::runtime::FromXml>::from_xml(reader, start)?;
crate::aom2_model::types::ValidityKind::from_wire(__s.trim()).map_err(|__e| {
crate::xml::runtime::XmlError::parse_source("element text of VALIDITY_KIND", __e)
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Archetype {
fn xml_type_name(&self) -> &'static str {
"ARCHETYPE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ARCHETYPE" {
__attrs.push(("xsi:type", "ARCHETYPE".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.archetype_id
.write_xml(w, "archetype_id", Some("ARCHETYPE_HRID"))?;
if let Some(v) = &self.parent_archetype_id {
v.write_xml(w, "parent_archetype_id", Some(""))?;
}
self.definition
.write_xml(w, "definition", Some("C_COMPLEX_OBJECT"))?;
for v in &self.rules {
v.write_xml(w, "rules", Some("RULE_STATEMENT"))?;
}
self.terminology
.write_xml(w, "terminology", Some("ARCHETYPE_TERMINOLOGY"))?;
if let Some(v) = &self.is_specialised {
v.write_xml(w, "is_specialised", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Archetype {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __archetype_id = None;
let mut __parent_archetype_id = None;
let mut __definition = None;
let mut __rules = Vec::new();
let mut __terminology = None;
let mut __is_specialised = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"archetype_id" => {
__archetype_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"parent_archetype_id" => {
__parent_archetype_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"definition" => {
__definition = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"rules" => {
__rules.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"terminology" => {
__terminology = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_specialised" => {
__is_specialised =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ARCHETYPE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Archetype {
archetype_id: __archetype_id
.ok_or_else(|| reader.missing_child("ARCHETYPE", "archetype_id"))?,
parent_archetype_id: __parent_archetype_id,
definition: __definition
.ok_or_else(|| reader.missing_child("ARCHETYPE", "definition"))?,
rules: __rules,
terminology: __terminology
.ok_or_else(|| reader.missing_child("ARCHETYPE", "terminology"))?,
is_specialised: __is_specialised,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ArchetypeConstraint {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::ArchetypeConstraint::ArchetypeSlot(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CArchetypeRoot(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CBoolean(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CComplexObject(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CComplexObjectProxy(x) => {
x.xml_type_name()
}
crate::aom2_model::types::ArchetypeConstraint::CDate(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CDateTime(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CDefinedObject(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CDuration(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CInteger(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CPrimitiveObject(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CReal(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CString(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CTemporal(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CTerminologyCode(x) => x.xml_type_name(),
crate::aom2_model::types::ArchetypeConstraint::CTime(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::ArchetypeConstraint::ArchetypeSlot(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CArchetypeRoot(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CBoolean(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CComplexObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CComplexObjectProxy(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CDate(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CDateTime(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CDefinedObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CDuration(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CInteger(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CPrimitiveObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CReal(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CString(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CTemporal(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CTerminologyCode(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ArchetypeConstraint::CTime(x) => {
x.write_xml(w, tag, declared)
}
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ArchetypeConstraint {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("ARCHETYPE_SLOT") => Ok(
crate::aom2_model::types::ArchetypeConstraint::ArchetypeSlot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_ARCHETYPE_ROOT") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CArchetypeRoot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_BOOLEAN") => Ok(crate::aom2_model::types::ArchetypeConstraint::CBoolean(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_COMPLEX_OBJECT") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CComplexObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_COMPLEX_OBJECT_PROXY") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CComplexObjectProxy(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_DATE") => Ok(crate::aom2_model::types::ArchetypeConstraint::CDate(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_DATE_TIME") => Ok(crate::aom2_model::types::ArchetypeConstraint::CDateTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_DEFINED_OBJECT") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CDefinedObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_DURATION") => Ok(crate::aom2_model::types::ArchetypeConstraint::CDuration(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_INTEGER") => Ok(crate::aom2_model::types::ArchetypeConstraint::CInteger(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_PRIMITIVE_OBJECT") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CPrimitiveObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_REAL") => Ok(crate::aom2_model::types::ArchetypeConstraint::CReal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_STRING") => Ok(crate::aom2_model::types::ArchetypeConstraint::CString(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_TEMPORAL") => Ok(crate::aom2_model::types::ArchetypeConstraint::CTemporal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_TERMINOLOGY_CODE") => Ok(
crate::aom2_model::types::ArchetypeConstraint::CTerminologyCode(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("C_TIME") => Ok(crate::aom2_model::types::ArchetypeConstraint::CTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
None => Err(crate::xml::runtime::XmlError::Parse(
"ArchetypeConstraint: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"ArchetypeConstraint: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no ARCHETYPE_CONSTRAINT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ArchetypeHrid {
fn xml_type_name(&self) -> &'static str {
"ARCHETYPE_HRID"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ARCHETYPE_HRID" {
__attrs.push(("xsi:type", "ARCHETYPE_HRID".to_string()));
}
}
if let Some(v) = &self.namespace {
__attrs.push(("namespace", v.to_string()));
}
if let Some(v) = &self.rm_publisher {
__attrs.push(("rm_publisher", v.to_string()));
}
if let Some(v) = &self.rm_package {
__attrs.push(("rm_package", v.to_string()));
}
if let Some(v) = &self.rm_class {
__attrs.push(("rm_class", v.to_string()));
}
if let Some(v) = &self.release_version {
__attrs.push(("release_version", v.to_string()));
}
if let Some(v) = &self.version_status {
__attrs.push(("version_status", v.to_string()));
}
if let Some(v) = &self.build_count {
__attrs.push(("build_count", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.concept_id {
v.write_xml(w, "concept_id", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ArchetypeHrid {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __concept_id = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"concept_id" => {
__concept_id = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ARCHETYPE_HRID".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ArchetypeHrid {
namespace: start.attr("namespace").map(|s| s.to_string()),
rm_publisher: start.attr("rm_publisher").map(|s| s.to_string()),
rm_package: start.attr("rm_package").map(|s| s.to_string()),
rm_class: start.attr("rm_class").map(|s| s.to_string()),
release_version: start.attr("release_version").map(|s| s.to_string()),
version_status: start.attr("version_status").map(|s| s.to_string()),
build_count: start.attr("build_count").map(|s| s.to_string()),
concept_id: __concept_id,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ArchetypeSlot {
fn xml_type_name(&self) -> &'static str {
"ARCHETYPE_SLOT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ARCHETYPE_SLOT" {
__attrs.push(("xsi:type", "ARCHETYPE_SLOT".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
for v in &self.includes {
v.write_xml(w, "includes", Some("ASSERTION"))?;
}
for v in &self.excludes {
v.write_xml(w, "excludes", Some("ASSERTION"))?;
}
self.is_closed.write_xml(w, "is_closed", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ArchetypeSlot {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __includes = Vec::new();
let mut __excludes = Vec::new();
let mut __is_closed = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"includes" => {
__includes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"excludes" => {
__excludes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_closed" => {
__is_closed = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ARCHETYPE_SLOT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ArchetypeSlot {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
includes: __includes,
excludes: __excludes,
is_closed: __is_closed.unwrap_or(false),
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ArchetypeTerm {
fn xml_type_name(&self) -> &'static str {
"ARCHETYPE_TERM"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ARCHETYPE_TERM" {
__attrs.push(("xsi:type", "ARCHETYPE_TERM".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.text.write_xml(w, "text", Some(""))?;
if let Some(v) = &self.description {
v.write_xml(w, "description", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ArchetypeTerm {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __text = None;
let mut __description = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"text" => {
__text = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"description" => {
__description = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ARCHETYPE_TERM".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ArchetypeTerm {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("ARCHETYPE_TERM", "id"))?
.to_string(),
text: __text.ok_or_else(|| reader.missing_child("ARCHETYPE_TERM", "text"))?,
description: __description,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ArchetypeTerminology {
fn xml_type_name(&self) -> &'static str {
"ARCHETYPE_TERMINOLOGY"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ARCHETYPE_TERMINOLOGY" {
__attrs.push(("xsi:type", "ARCHETYPE_TERMINOLOGY".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.term_definitions {
v.write_xml(w, "term_definitions", Some("CodeDefinitionSet"))?;
}
for v in &self.term_bindings {
v.write_xml(w, "term_bindings", Some("TermBindingSet"))?;
}
for v in &self.value_sets {
v.write_xml(w, "value_sets", Some("VALUE_SET"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ArchetypeTerminology {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __term_definitions = Vec::new();
let mut __term_bindings = Vec::new();
let mut __value_sets = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"term_definitions" => {
__term_definitions
.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"term_bindings" => {
__term_bindings.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"value_sets" => {
__value_sets.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ARCHETYPE_TERMINOLOGY".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ArchetypeTerminology {
term_definitions: __term_definitions,
term_bindings: __term_bindings,
value_sets: __value_sets,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Assertion {
fn xml_type_name(&self) -> &'static str {
"ASSERTION"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ASSERTION" {
__attrs.push(("xsi:type", "ASSERTION".to_string()));
}
}
if let Some(v) = &self.r#type {
__attrs.push(("type", v.to_string()));
}
if let Some(v) = &self.tag {
__attrs.push(("tag", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.expression
.write_xml(w, "expression", Some("EXPR_ITEM"))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Assertion {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __expression = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"expression" => {
__expression = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ASSERTION".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Assertion {
r#type: start.attr("type").map(|s| s.to_string()),
tag: start.attr("tag").map(|s| s.to_string()),
expression: __expression
.ok_or_else(|| reader.missing_child("ASSERTION", "expression"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::AssertionVariable {
fn xml_type_name(&self) -> &'static str {
"ASSERTION_VARIABLE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "ASSERTION_VARIABLE" {
__attrs.push(("xsi:type", "ASSERTION_VARIABLE".to_string()));
}
}
if let Some(v) = &self.name {
__attrs.push(("name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.definition.write_xml(w, "definition", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::AssertionVariable {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __definition = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"definition" => {
__definition = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "ASSERTION_VARIABLE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::AssertionVariable {
name: start.attr("name").map(|s| s.to_string()),
definition: __definition
.ok_or_else(|| reader.missing_child("ASSERTION_VARIABLE", "definition"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::AuthoredArchetype {
fn xml_type_name(&self) -> &'static str {
"AUTHORED_ARCHETYPE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "AUTHORED_ARCHETYPE" {
__attrs.push(("xsi:type", "AUTHORED_ARCHETYPE".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.original_language
.write_xml(w, "original_language", Some("TERMINOLOGY_CODE"))?;
if let Some(v) = &self.is_controlled {
v.write_xml(w, "is_controlled", Some(""))?;
}
if let Some(v) = &self.description {
v.write_xml(w, "description", Some("RESOURCE_DESCRIPTION"))?;
}
for v in &self.translations {
v.write_xml(w, "translations", Some("TRANSLATION_DETAILS"))?;
}
if let Some(v) = &self.uid {
v.write_xml(w, "uid", Some(""))?;
}
for v in &self.annotations {
v.write_xml(w, "annotations", Some("RESOURCE_ANNOTATIONS"))?;
}
self.archetype_id
.write_xml(w, "archetype_id", Some("ARCHETYPE_HRID"))?;
if let Some(v) = &self.parent_archetype_id {
v.write_xml(w, "parent_archetype_id", Some(""))?;
}
self.definition
.write_xml(w, "definition", Some("C_COMPLEX_OBJECT"))?;
for v in &self.rules {
v.write_xml(w, "rules", Some("RULE_STATEMENT"))?;
}
self.terminology
.write_xml(w, "terminology", Some("ARCHETYPE_TERMINOLOGY"))?;
if let Some(v) = &self.is_specialised {
v.write_xml(w, "is_specialised", Some(""))?;
}
if let Some(v) = &self.build_uid {
v.write_xml(w, "build_uid", Some(""))?;
}
if let Some(v) = &self.adl_version {
v.write_xml(w, "adl_version", Some(""))?;
}
if let Some(v) = &self.is_generated {
v.write_xml(w, "is_generated", Some(""))?;
}
if let Some(m) = &self.other_metadata {
for (k, v) in m {
w.write_kv_element("other_metadata", k, v)?;
}
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::AuthoredArchetype {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __original_language = None;
let mut __is_controlled = None;
let mut __description = None;
let mut __translations = Vec::new();
let mut __uid = None;
let mut __annotations = Vec::new();
let mut __archetype_id = None;
let mut __parent_archetype_id = None;
let mut __definition = None;
let mut __rules = Vec::new();
let mut __terminology = None;
let mut __is_specialised = None;
let mut __build_uid = None;
let mut __adl_version = None;
let mut __is_generated = None;
let mut __other_metadata = indexmap::IndexMap::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"original_language" => {
__original_language =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_controlled" => {
__is_controlled =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"description" => {
__description = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"translations" => {
__translations.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"uid" => {
__uid = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"annotations" => {
__annotations.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"archetype_id" => {
__archetype_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"parent_archetype_id" => {
__parent_archetype_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"definition" => {
__definition = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"rules" => {
__rules.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"terminology" => {
__terminology = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_specialised" => {
__is_specialised =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"build_uid" => {
__build_uid = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"adl_version" => {
__adl_version = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_generated" => {
__is_generated =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"other_metadata" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__other_metadata.insert(__k, __v);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "AUTHORED_ARCHETYPE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::AuthoredArchetype {
original_language: __original_language
.ok_or_else(|| reader.missing_child("AUTHORED_ARCHETYPE", "original_language"))?,
is_controlled: __is_controlled,
description: __description,
translations: __translations,
uid: __uid,
annotations: __annotations,
archetype_id: __archetype_id
.ok_or_else(|| reader.missing_child("AUTHORED_ARCHETYPE", "archetype_id"))?,
parent_archetype_id: __parent_archetype_id,
definition: __definition
.ok_or_else(|| reader.missing_child("AUTHORED_ARCHETYPE", "definition"))?,
rules: __rules,
terminology: __terminology
.ok_or_else(|| reader.missing_child("AUTHORED_ARCHETYPE", "terminology"))?,
is_specialised: __is_specialised,
build_uid: __build_uid,
adl_version: __adl_version,
is_generated: __is_generated,
other_metadata: if __other_metadata.is_empty() {
None
} else {
Some(__other_metadata)
},
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::AuthoredResource {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::AuthoredResource::AuthoredArchetype(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::AuthoredResource::AuthoredArchetype(x) => {
x.write_xml(w, tag, declared)
}
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::AuthoredResource {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("AUTHORED_ARCHETYPE") => Ok(
crate::aom2_model::types::AuthoredResource::AuthoredArchetype(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
None => Err(crate::xml::runtime::XmlError::Parse(
"AuthoredResource: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"AuthoredResource: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no AUTHORED_RESOURCE subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Annotationlangset {
fn xml_type_name(&self) -> &'static str {
"AnnotationLangSet"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "AnnotationLangSet" {
__attrs.push(("xsi:type", "AnnotationLangSet".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.items {
v.write_xml(w, "items", Some("AnnotationPathSet"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Annotationlangset {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __items = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"items" => {
__items.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "AnnotationLangSet".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Annotationlangset {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("AnnotationLangSet", "id"))?
.to_string(),
items: __items,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Annotationpathset {
fn xml_type_name(&self) -> &'static str {
"AnnotationPathSet"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "AnnotationPathSet" {
__attrs.push(("xsi:type", "AnnotationPathSet".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(m) = &self.items {
for (k, v) in m {
w.write_kv_element("items", k, v)?;
}
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Annotationpathset {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __items = indexmap::IndexMap::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"items" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__items.insert(__k, __v);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "AnnotationPathSet".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Annotationpathset {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("AnnotationPathSet", "id"))?
.to_string(),
items: if __items.is_empty() {
None
} else {
Some(__items)
},
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Cardinality {
fn xml_type_name(&self) -> &'static str {
"CARDINALITY"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "CARDINALITY" {
__attrs.push(("xsi:type", "CARDINALITY".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.is_ordered.write_xml(w, "is_ordered", Some(""))?;
self.is_unique.write_xml(w, "is_unique", Some(""))?;
self.interval
.write_xml(w, "interval", Some("MultiplicityInterval"))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Cardinality {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __is_ordered = None;
let mut __is_unique = None;
let mut __interval = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"is_ordered" => {
__is_ordered = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_unique" => {
__is_unique = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"interval" => {
__interval = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "CARDINALITY".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Cardinality {
is_ordered: __is_ordered.unwrap_or(false),
is_unique: __is_unique.unwrap_or(false),
interval: __interval.ok_or_else(|| reader.missing_child("CARDINALITY", "interval"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CArchetypeRoot {
fn xml_type_name(&self) -> &'static str {
"C_ARCHETYPE_ROOT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_ARCHETYPE_ROOT" {
__attrs.push(("xsi:type", "C_ARCHETYPE_ROOT".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
for v in &self.attributes {
v.write_xml(w, "attributes", Some("C_ATTRIBUTE"))?;
}
if let Some(v) = &self.archetype_ref {
v.write_xml(w, "archetype_ref", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CArchetypeRoot {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __attributes = Vec::new();
let mut __archetype_ref = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"attributes" => {
__attributes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"archetype_ref" => {
__archetype_ref =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_ARCHETYPE_ROOT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CArchetypeRoot {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
attributes: __attributes,
archetype_ref: __archetype_ref,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CAttribute {
fn xml_type_name(&self) -> &'static str {
"C_ATTRIBUTE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_ATTRIBUTE" {
__attrs.push(("xsi:type", "C_ATTRIBUTE".to_string()));
}
}
__attrs.push(("rm_attribute_name", self.rm_attribute_name.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.existence
.write_xml(w, "existence", Some("MultiplicityInterval"))?;
if let Some(v) = &self.differential_path {
v.write_xml(w, "differential_path", Some(""))?;
}
self.is_multiple.write_xml(w, "is_multiple", Some(""))?;
self.cardinality
.write_xml(w, "cardinality", Some("CARDINALITY"))?;
for v in &self.children {
v.write_xml(w, "children", Some("C_OBJECT"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CAttribute {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __existence = None;
let mut __differential_path = None;
let mut __is_multiple = None;
let mut __cardinality = None;
let mut __children = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"existence" => {
__existence = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"differential_path" => {
__differential_path =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_multiple" => {
__is_multiple = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"cardinality" => {
__cardinality = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"children" => {
__children.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_ATTRIBUTE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CAttribute {
rm_attribute_name: start
.attr("rm_attribute_name")
.ok_or_else(|| reader.missing_attribute("C_ATTRIBUTE", "rm_attribute_name"))?
.to_string(),
existence: __existence
.ok_or_else(|| reader.missing_child("C_ATTRIBUTE", "existence"))?,
differential_path: __differential_path,
is_multiple: __is_multiple.unwrap_or(false),
cardinality: __cardinality
.ok_or_else(|| reader.missing_child("C_ATTRIBUTE", "cardinality"))?,
children: __children,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CBoolean {
fn xml_type_name(&self) -> &'static str {
"C_BOOLEAN"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_BOOLEAN" {
__attrs.push(("xsi:type", "C_BOOLEAN".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
self.constraint.write_xml(w, "constraint", Some(""))?;
if let Some(v) = &self.default_value {
v.write_xml(w, "default_value", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CBoolean {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __assumed_value = None;
let mut __constraint = None;
let mut __default_value = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"default_value" => {
__default_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_BOOLEAN".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CBoolean {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
assumed_value: __assumed_value,
constraint: __constraint.unwrap_or(false),
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CComplexObject {
fn xml_type_name(&self) -> &'static str {
"C_COMPLEX_OBJECT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_COMPLEX_OBJECT" {
__attrs.push(("xsi:type", "C_COMPLEX_OBJECT".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
for v in &self.attributes {
v.write_xml(w, "attributes", Some("C_ATTRIBUTE"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CComplexObject {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __attributes = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"attributes" => {
__attributes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_COMPLEX_OBJECT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CComplexObject {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
attributes: __attributes,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CComplexObjectProxy {
fn xml_type_name(&self) -> &'static str {
"C_COMPLEX_OBJECT_PROXY"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_COMPLEX_OBJECT_PROXY" {
__attrs.push(("xsi:type", "C_COMPLEX_OBJECT_PROXY".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
self.target_path.write_xml(w, "target_path", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CComplexObjectProxy {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __target_path = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"target_path" => {
__target_path = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_COMPLEX_OBJECT_PROXY".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CComplexObjectProxy {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
target_path: __target_path
.ok_or_else(|| reader.missing_child("C_COMPLEX_OBJECT_PROXY", "target_path"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CDate {
fn xml_type_name(&self) -> &'static str {
"C_DATE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_DATE" {
__attrs.push(("xsi:type", "C_DATE".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CDate {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_DATE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CDate {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CDateTime {
fn xml_type_name(&self) -> &'static str {
"C_DATE_TIME"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_DATE_TIME" {
__attrs.push(("xsi:type", "C_DATE_TIME".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CDateTime {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __pattern_constraint = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_DATE_TIME".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CDateTime {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
pattern_constraint: __pattern_constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CDefinedObject {
fn xml_type_name(&self) -> &'static str {
"C_DEFINED_OBJECT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_DEFINED_OBJECT" {
__attrs.push(("xsi:type", "C_DEFINED_OBJECT".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CDefinedObject {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_DEFINED_OBJECT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CDefinedObject {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CDuration {
fn xml_type_name(&self) -> &'static str {
"C_DURATION"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_DURATION" {
__attrs.push(("xsi:type", "C_DURATION".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CDuration {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __pattern_constraint = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_DURATION".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CDuration {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
pattern_constraint: __pattern_constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CInteger {
fn xml_type_name(&self) -> &'static str {
"C_INTEGER"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_INTEGER" {
__attrs.push(("xsi:type", "C_INTEGER".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
self.constraint
.write_xml(w, "constraint", Some("IntervalOfInteger"))?;
if let Some(v) = &self.default_value {
v.write_xml(w, "default_value", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CInteger {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __assumed_value = None;
let mut __constraint = None;
let mut __default_value = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"default_value" => {
__default_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_INTEGER".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CInteger {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
assumed_value: __assumed_value,
constraint: __constraint
.ok_or_else(|| reader.missing_child("C_INTEGER", "constraint"))?,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CObject {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::CObject::ArchetypeSlot(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CArchetypeRoot(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CBoolean(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CComplexObject(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CComplexObjectProxy(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CDate(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CDateTime(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CDefinedObject(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CDuration(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CInteger(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CPrimitiveObject(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CReal(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CString(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CTemporal(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CTerminologyCode(x) => x.xml_type_name(),
crate::aom2_model::types::CObject::CTime(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::CObject::ArchetypeSlot(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CArchetypeRoot(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CBoolean(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CComplexObject(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CComplexObjectProxy(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::CObject::CDate(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CDateTime(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CDefinedObject(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CDuration(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CInteger(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CPrimitiveObject(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CReal(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CString(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CTemporal(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CTerminologyCode(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::CObject::CTime(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CObject {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("ARCHETYPE_SLOT") => Ok(crate::aom2_model::types::CObject::ArchetypeSlot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_ARCHETYPE_ROOT") => Ok(crate::aom2_model::types::CObject::CArchetypeRoot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_BOOLEAN") => Ok(crate::aom2_model::types::CObject::CBoolean(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_COMPLEX_OBJECT") => Ok(crate::aom2_model::types::CObject::CComplexObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_COMPLEX_OBJECT_PROXY") => {
Ok(crate::aom2_model::types::CObject::CComplexObjectProxy(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("C_DATE") => Ok(crate::aom2_model::types::CObject::CDate(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_DATE_TIME") => Ok(crate::aom2_model::types::CObject::CDateTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_DEFINED_OBJECT") => Ok(crate::aom2_model::types::CObject::CDefinedObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_DURATION") => Ok(crate::aom2_model::types::CObject::CDuration(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_INTEGER") => Ok(crate::aom2_model::types::CObject::CInteger(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_PRIMITIVE_OBJECT") => Ok(crate::aom2_model::types::CObject::CPrimitiveObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_REAL") => Ok(crate::aom2_model::types::CObject::CReal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_STRING") => Ok(crate::aom2_model::types::CObject::CString(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_TEMPORAL") => Ok(crate::aom2_model::types::CObject::CTemporal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_TERMINOLOGY_CODE") => Ok(crate::aom2_model::types::CObject::CTerminologyCode(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("C_TIME") => Ok(crate::aom2_model::types::CObject::CTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
None => Err(crate::xml::runtime::XmlError::Parse(
"CObject: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"CObject: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no C_OBJECT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CPrimitiveObject {
fn xml_type_name(&self) -> &'static str {
"C_PRIMITIVE_OBJECT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_PRIMITIVE_OBJECT" {
__attrs.push(("xsi:type", "C_PRIMITIVE_OBJECT".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CPrimitiveObject {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_PRIMITIVE_OBJECT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CPrimitiveObject {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CReal {
fn xml_type_name(&self) -> &'static str {
"C_REAL"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_REAL" {
__attrs.push(("xsi:type", "C_REAL".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
self.constraint
.write_xml(w, "constraint", Some("IntervalOfReal"))?;
if let Some(v) = &self.default_value {
v.write_xml(w, "default_value", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CReal {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __assumed_value = None;
let mut __constraint = None;
let mut __default_value = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"default_value" => {
__default_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_REAL".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CReal {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
assumed_value: __assumed_value,
constraint: __constraint.ok_or_else(|| reader.missing_child("C_REAL", "constraint"))?,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CString {
fn xml_type_name(&self) -> &'static str {
"C_STRING"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_STRING" {
__attrs.push(("xsi:type", "C_STRING".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
self.constraint.write_xml(w, "constraint", Some(""))?;
if let Some(v) = &self.default_value {
v.write_xml(w, "default_value", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CString {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __assumed_value = None;
let mut __constraint = None;
let mut __default_value = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"default_value" => {
__default_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_STRING".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CString {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
assumed_value: __assumed_value,
constraint: __constraint
.ok_or_else(|| reader.missing_child("C_STRING", "constraint"))?,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CTemporal {
fn xml_type_name(&self) -> &'static str {
"C_TEMPORAL"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_TEMPORAL" {
__attrs.push(("xsi:type", "C_TEMPORAL".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CTemporal {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_TEMPORAL".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CTemporal {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CTerminologyCode {
fn xml_type_name(&self) -> &'static str {
"C_TERMINOLOGY_CODE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_TERMINOLOGY_CODE" {
__attrs.push(("xsi:type", "C_TERMINOLOGY_CODE".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.assumed_value {
v.write_xml(w, "assumed_value", Some("TERMINOLOGY_CODE"))?;
}
self.constraint.write_xml(w, "constraint", Some(""))?;
if let Some(v) = &self.default_value {
v.write_xml(w, "default_value", Some("TERMINOLOGY_CODE"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CTerminologyCode {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __assumed_value = None;
let mut __constraint = None;
let mut __default_value = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"default_value" => {
__default_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_TERMINOLOGY_CODE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CTerminologyCode {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
assumed_value: __assumed_value,
constraint: __constraint
.ok_or_else(|| reader.missing_child("C_TERMINOLOGY_CODE", "constraint"))?,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::CTime {
fn xml_type_name(&self) -> &'static str {
"C_TIME"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "C_TIME" {
__attrs.push(("xsi:type", "C_TIME".to_string()));
}
}
if let Some(v) = &self.is_deprecated {
__attrs.push(("is_deprecated", v.to_string()));
}
if let Some(v) = &self.node_id {
__attrs.push(("node_id", v.to_string()));
}
if let Some(v) = &self.rm_type_name {
__attrs.push(("rm_type_name", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.sibling_order {
v.write_xml(w, "sibling_order", Some("SIBLING_ORDER"))?;
}
if let Some(v) = &self.occurrences {
v.write_xml(w, "occurrences", Some("MultiplicityInterval"))?;
}
if let Some(v) = &self.is_frozen {
v.write_xml(w, "is_frozen", Some(""))?;
}
if let Some(v) = &self.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::CTime {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_order = Vec::new();
let mut __occurrences = None;
let mut __is_frozen = None;
let mut __pattern_constraint = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_order" => {
__sibling_order.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"occurrences" => {
__occurrences = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"is_frozen" => {
__is_frozen = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "C_TIME".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::CTime {
is_deprecated: start.attr("is_deprecated").map(|s| s.to_string()),
node_id: start.attr("node_id").map(|s| s.to_string()),
rm_type_name: start.attr("rm_type_name").map(|s| s.to_string()),
sibling_order: __sibling_order,
occurrences: __occurrences,
is_frozen: __is_frozen,
pattern_constraint: __pattern_constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Codedefinitionset {
fn xml_type_name(&self) -> &'static str {
"CodeDefinitionSet"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "CodeDefinitionSet" {
__attrs.push(("xsi:type", "CodeDefinitionSet".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.items {
v.write_xml(w, "items", Some("ARCHETYPE_TERM"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Codedefinitionset {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __items = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"items" => {
__items.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "CodeDefinitionSet".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Codedefinitionset {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("CodeDefinitionSet", "id"))?
.to_string(),
items: __items,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ExprBinaryOperator {
fn xml_type_name(&self) -> &'static str {
"EXPR_BINARY_OPERATOR"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "EXPR_BINARY_OPERATOR" {
__attrs.push(("xsi:type", "EXPR_BINARY_OPERATOR".to_string()));
}
}
if let Some(v) = &self.r#type {
__attrs.push(("type", v.to_string()));
}
if let Some(v) = &self.precedence_overridden {
__attrs.push(("precedence_overridden", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.operator
.write_xml(w, "operator", Some("OPERATOR_KIND"))?;
self.left_operand
.write_xml(w, "left_operand", Some("EXPR_ITEM"))?;
self.right_operand
.write_xml(w, "right_operand", Some("EXPR_ITEM"))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ExprBinaryOperator {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __operator = None;
let mut __left_operand = None;
let mut __right_operand = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"operator" => {
__operator = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"left_operand" => {
__left_operand =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"right_operand" => {
__right_operand =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "EXPR_BINARY_OPERATOR".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ExprBinaryOperator {
r#type: start.attr("type").map(|s| s.to_string()),
precedence_overridden: start.attr("precedence_overridden").map(|s| s.to_string()),
operator: __operator
.ok_or_else(|| reader.missing_child("EXPR_BINARY_OPERATOR", "operator"))?,
left_operand: __left_operand
.ok_or_else(|| reader.missing_child("EXPR_BINARY_OPERATOR", "left_operand"))?,
right_operand: __right_operand
.ok_or_else(|| reader.missing_child("EXPR_BINARY_OPERATOR", "right_operand"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ExprItem {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::ExprItem::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2_model::types::ExprItem::ExprLeaf(x) => x.xml_type_name(),
crate::aom2_model::types::ExprItem::ExprUnaryOperator(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::ExprItem::ExprBinaryOperator(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ExprItem::ExprLeaf(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::ExprItem::ExprUnaryOperator(x) => {
x.write_xml(w, tag, declared)
}
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ExprItem {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("EXPR_BINARY_OPERATOR") => {
Ok(crate::aom2_model::types::ExprItem::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("EXPR_LEAF") => Ok(crate::aom2_model::types::ExprItem::ExprLeaf(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_UNARY_OPERATOR") => {
Ok(crate::aom2_model::types::ExprItem::ExprUnaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
None => Err(crate::xml::runtime::XmlError::Parse(
"ExprItem: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"ExprItem: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no EXPR_ITEM subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ExprLeaf {
fn xml_type_name(&self) -> &'static str {
"EXPR_LEAF"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "EXPR_LEAF" {
__attrs.push(("xsi:type", "EXPR_LEAF".to_string()));
}
}
if let Some(v) = &self.r#type {
__attrs.push(("type", v.to_string()));
}
if let Some(v) = &self.reference_type {
__attrs.push(("reference_type", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.item.write_xml(w, "item", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ExprLeaf {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __item = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"item" => {
__item = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "EXPR_LEAF".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ExprLeaf {
r#type: start.attr("type").map(|s| s.to_string()),
reference_type: start.attr("reference_type").map(|s| s.to_string()),
item: __item.ok_or_else(|| reader.missing_child("EXPR_LEAF", "item"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ExprOperator {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::ExprOperator::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2_model::types::ExprOperator::ExprUnaryOperator(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::ExprOperator::ExprBinaryOperator(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::ExprOperator::ExprUnaryOperator(x) => {
x.write_xml(w, tag, declared)
}
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ExprOperator {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("EXPR_BINARY_OPERATOR") => {
Ok(crate::aom2_model::types::ExprOperator::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("EXPR_UNARY_OPERATOR") => {
Ok(crate::aom2_model::types::ExprOperator::ExprUnaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
None => Err(crate::xml::runtime::XmlError::Parse(
"ExprOperator: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"ExprOperator: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no EXPR_OPERATOR subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ExprUnaryOperator {
fn xml_type_name(&self) -> &'static str {
"EXPR_UNARY_OPERATOR"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "EXPR_UNARY_OPERATOR" {
__attrs.push(("xsi:type", "EXPR_UNARY_OPERATOR".to_string()));
}
}
if let Some(v) = &self.r#type {
__attrs.push(("type", v.to_string()));
}
if let Some(v) = &self.precedence_overridden {
__attrs.push(("precedence_overridden", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.operator
.write_xml(w, "operator", Some("OPERATOR_KIND"))?;
self.operand.write_xml(w, "operand", Some("EXPR_ITEM"))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ExprUnaryOperator {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __operator = None;
let mut __operand = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"operator" => {
__operator = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"operand" => {
__operand = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "EXPR_UNARY_OPERATOR".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ExprUnaryOperator {
r#type: start.attr("type").map(|s| s.to_string()),
precedence_overridden: start.attr("precedence_overridden").map(|s| s.to_string()),
operator: __operator
.ok_or_else(|| reader.missing_child("EXPR_UNARY_OPERATOR", "operator"))?,
operand: __operand
.ok_or_else(|| reader.missing_child("EXPR_UNARY_OPERATOR", "operand"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervalofdate {
fn xml_type_name(&self) -> &'static str {
"IntervalOfDate"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfDate" {
__attrs.push(("xsi:type", "IntervalOfDate".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervalofdate {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfDate".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervalofdate {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervalofdatetime {
fn xml_type_name(&self) -> &'static str {
"IntervalOfDateTime"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfDateTime" {
__attrs.push(("xsi:type", "IntervalOfDateTime".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervalofdatetime {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfDateTime".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervalofdatetime {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervalofduration {
fn xml_type_name(&self) -> &'static str {
"IntervalOfDuration"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfDuration" {
__attrs.push(("xsi:type", "IntervalOfDuration".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervalofduration {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfDuration".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervalofduration {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervalofinteger {
fn xml_type_name(&self) -> &'static str {
"IntervalOfInteger"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfInteger" {
__attrs.push(("xsi:type", "IntervalOfInteger".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervalofinteger {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfInteger".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervalofinteger {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervalofreal {
fn xml_type_name(&self) -> &'static str {
"IntervalOfReal"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfReal" {
__attrs.push(("xsi:type", "IntervalOfReal".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervalofreal {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfReal".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervalofreal {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Intervaloftime {
fn xml_type_name(&self) -> &'static str {
"IntervalOfTime"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "IntervalOfTime" {
__attrs.push(("xsi:type", "IntervalOfTime".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Intervaloftime {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "IntervalOfTime".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Intervaloftime {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Multiplicityinterval {
fn xml_type_name(&self) -> &'static str {
"MultiplicityInterval"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "MultiplicityInterval" {
__attrs.push(("xsi:type", "MultiplicityInterval".to_string()));
}
}
if let Some(v) = &self.lower_included {
__attrs.push(("lower_included", v.to_string()));
}
if let Some(v) = &self.upper_included {
__attrs.push(("upper_included", v.to_string()));
}
if let Some(v) = &self.lower_unbounded {
__attrs.push(("lower_unbounded", v.to_string()));
}
if let Some(v) = &self.upper_unbounded {
__attrs.push(("upper_unbounded", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(v) = &self.lower {
v.write_xml(w, "lower", Some(""))?;
}
if let Some(v) = &self.upper {
v.write_xml(w, "upper", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Multiplicityinterval {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lower = None;
let mut __upper = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lower" => {
__lower = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"upper" => {
__upper = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "MultiplicityInterval".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Multiplicityinterval {
lower_included: start.attr("lower_included").map(|s| s.to_string()),
upper_included: start.attr("upper_included").map(|s| s.to_string()),
lower_unbounded: start.attr("lower_unbounded").map(|s| s.to_string()),
upper_unbounded: start.attr("upper_unbounded").map(|s| s.to_string()),
lower: __lower,
upper: __upper,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::OperatorKind {
fn xml_type_name(&self) -> &'static str {
"OPERATOR_KIND"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "OPERATOR_KIND" {
__attrs.push(("xsi:type", "OPERATOR_KIND".to_string()));
}
}
__attrs.push(("value", self.value.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::OperatorKind {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "OPERATOR_KIND".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::OperatorKind {
value: start
.attr("value")
.ok_or_else(|| reader.missing_attribute("OPERATOR_KIND", "value"))?
.to_string(),
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ResourceDescription {
fn xml_type_name(&self) -> &'static str {
"RESOURCE_DESCRIPTION"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "RESOURCE_DESCRIPTION" {
__attrs.push(("xsi:type", "RESOURCE_DESCRIPTION".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.lifecycle_state
.write_xml(w, "lifecycle_state", Some(""))?;
if let Some(v) = &self.custodian_namespace {
v.write_xml(w, "custodian_namespace", Some(""))?;
}
if let Some(v) = &self.custodian_organisation {
v.write_xml(w, "custodian_organisation", Some(""))?;
}
for (k, v) in &self.original_author {
w.write_kv_element("original_author", k, v)?;
}
if let Some(v) = &self.original_namespace {
v.write_xml(w, "original_namespace", Some(""))?;
}
if let Some(v) = &self.original_publisher {
v.write_xml(w, "original_publisher", Some(""))?;
}
for v in &self.other_contributors {
v.write_xml(w, "other_contributors", Some(""))?;
}
if let Some(v) = &self.copyright {
v.write_xml(w, "copyright", Some(""))?;
}
if let Some(v) = &self.licence {
v.write_xml(w, "licence", Some(""))?;
}
if let Some(m) = &self.ip_acknowledgements {
for (k, v) in m {
w.write_kv_element("ip_acknowledgements", k, v)?;
}
}
if let Some(v) = &self.resource_package_uri {
v.write_xml(w, "resource_package_uri", Some(""))?;
}
if let Some(m) = &self.references {
for (k, v) in m {
w.write_kv_element("references", k, v)?;
}
}
if let Some(m) = &self.other_details {
for (k, v) in m {
w.write_kv_element("other_details", k, v)?;
}
}
for v in &self.details {
v.write_xml(w, "details", Some("RESOURCE_DESCRIPTION_ITEM"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ResourceDescription {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __lifecycle_state = None;
let mut __custodian_namespace = None;
let mut __custodian_organisation = None;
let mut __original_author = indexmap::IndexMap::new();
let mut __original_namespace = None;
let mut __original_publisher = None;
let mut __other_contributors = Vec::new();
let mut __copyright = None;
let mut __licence = None;
let mut __ip_acknowledgements = indexmap::IndexMap::new();
let mut __resource_package_uri = None;
let mut __references = indexmap::IndexMap::new();
let mut __other_details = indexmap::IndexMap::new();
let mut __details = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"lifecycle_state" => {
__lifecycle_state =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"custodian_namespace" => {
__custodian_namespace =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"custodian_organisation" => {
__custodian_organisation =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"original_author" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__original_author.insert(__k, __v);
}
"original_namespace" => {
__original_namespace =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"original_publisher" => {
__original_publisher =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"other_contributors" => {
__other_contributors
.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"copyright" => {
__copyright = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"licence" => {
__licence = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"ip_acknowledgements" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__ip_acknowledgements.insert(__k, __v);
}
"resource_package_uri" => {
__resource_package_uri =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"references" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__references.insert(__k, __v);
}
"other_details" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__other_details.insert(__k, __v);
}
"details" => {
__details.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "RESOURCE_DESCRIPTION".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ResourceDescription {
lifecycle_state: __lifecycle_state
.ok_or_else(|| reader.missing_child("RESOURCE_DESCRIPTION", "lifecycle_state"))?,
custodian_namespace: __custodian_namespace,
custodian_organisation: __custodian_organisation,
original_author: __original_author,
original_namespace: __original_namespace,
original_publisher: __original_publisher,
other_contributors: __other_contributors,
copyright: __copyright,
licence: __licence,
ip_acknowledgements: if __ip_acknowledgements.is_empty() {
None
} else {
Some(__ip_acknowledgements)
},
resource_package_uri: __resource_package_uri,
references: if __references.is_empty() {
None
} else {
Some(__references)
},
other_details: if __other_details.is_empty() {
None
} else {
Some(__other_details)
},
details: __details,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ResourceDescriptionItem {
fn xml_type_name(&self) -> &'static str {
"RESOURCE_DESCRIPTION_ITEM"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "RESOURCE_DESCRIPTION_ITEM" {
__attrs.push(("xsi:type", "RESOURCE_DESCRIPTION_ITEM".to_string()));
}
}
if let Some(v) = &self.id {
__attrs.push(("id", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.language.write_xml(w, "language", Some(""))?;
self.purpose.write_xml(w, "purpose", Some(""))?;
if let Some(v) = &self.use_ {
v.write_xml(w, "use", Some(""))?;
}
if let Some(v) = &self.misuse {
v.write_xml(w, "misuse", Some(""))?;
}
for v in &self.keywords {
v.write_xml(w, "keywords", Some(""))?;
}
if let Some(m) = &self.original_resource_uri {
for (k, v) in m {
w.write_kv_element("original_resource_uri", k, v)?;
}
}
if let Some(m) = &self.other_details {
for (k, v) in m {
w.write_kv_element("other_details", k, v)?;
}
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ResourceDescriptionItem {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __language = None;
let mut __purpose = None;
let mut __use_ = None;
let mut __misuse = None;
let mut __keywords = Vec::new();
let mut __original_resource_uri = indexmap::IndexMap::new();
let mut __other_details = indexmap::IndexMap::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"language" => {
__language = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"purpose" => {
__purpose = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"use" => {
__use_ = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"misuse" => {
__misuse = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"keywords" => {
__keywords.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"original_resource_uri" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__original_resource_uri.insert(__k, __v);
}
"other_details" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__other_details.insert(__k, __v);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "RESOURCE_DESCRIPTION_ITEM".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ResourceDescriptionItem {
id: start.attr("id").map(|s| s.to_string()),
language: __language
.ok_or_else(|| reader.missing_child("RESOURCE_DESCRIPTION_ITEM", "language"))?,
purpose: __purpose.unwrap_or(String::new()),
use_: __use_,
misuse: __misuse,
keywords: __keywords,
original_resource_uri: if __original_resource_uri.is_empty() {
None
} else {
Some(__original_resource_uri)
},
other_details: if __other_details.is_empty() {
None
} else {
Some(__other_details)
},
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::RuleElement {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2_model::types::RuleElement::Assertion(x) => x.xml_type_name(),
crate::aom2_model::types::RuleElement::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2_model::types::RuleElement::ExprLeaf(x) => x.xml_type_name(),
crate::aom2_model::types::RuleElement::ExprUnaryOperator(x) => x.xml_type_name(),
crate::aom2_model::types::RuleElement::RuleStatement(x) => x.xml_type_name(),
}
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
match self {
crate::aom2_model::types::RuleElement::Assertion(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::RuleElement::ExprBinaryOperator(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::RuleElement::ExprLeaf(x) => x.write_xml(w, tag, declared),
crate::aom2_model::types::RuleElement::ExprUnaryOperator(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2_model::types::RuleElement::RuleStatement(x) => {
x.write_xml(w, tag, declared)
}
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::RuleElement {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
match start.xsi_type() {
Some("ASSERTION") => Ok(crate::aom2_model::types::RuleElement::Assertion(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_BINARY_OPERATOR") => {
Ok(crate::aom2_model::types::RuleElement::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("EXPR_LEAF") => Ok(crate::aom2_model::types::RuleElement::ExprLeaf(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_UNARY_OPERATOR") => {
Ok(crate::aom2_model::types::RuleElement::ExprUnaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("RULE_STATEMENT") => Ok(crate::aom2_model::types::RuleElement::RuleStatement(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
None => Err(crate::xml::runtime::XmlError::Parse(
"RuleElement: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"RuleElement: unknown xsi:type {other}: the ITS-XML AOM2 model-form schemas (Archetype.xsd) define no RULE_ELEMENT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::RuleStatement {
fn xml_type_name(&self) -> &'static str {
"RULE_STATEMENT"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "RULE_STATEMENT" {
__attrs.push(("xsi:type", "RULE_STATEMENT".to_string()));
}
}
if let Some(v) = &self.r#type {
__attrs.push(("type", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::RuleStatement {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "RULE_STATEMENT".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::RuleStatement {
r#type: start.attr("type").map(|s| s.to_string()),
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::SiblingOrder {
fn xml_type_name(&self) -> &'static str {
"SIBLING_ORDER"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "SIBLING_ORDER" {
__attrs.push(("xsi:type", "SIBLING_ORDER".to_string()));
}
}
if let Some(v) = &self.is_before {
__attrs.push(("is_before", v.to_string()));
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.sibling_node_id
.write_xml(w, "sibling_node_id", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::SiblingOrder {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __sibling_node_id = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"sibling_node_id" => {
__sibling_node_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "SIBLING_ORDER".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::SiblingOrder {
is_before: start.attr("is_before").map(|s| s.to_string()),
sibling_node_id: __sibling_node_id
.ok_or_else(|| reader.missing_child("SIBLING_ORDER", "sibling_node_id"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::TerminologyCode {
fn xml_type_name(&self) -> &'static str {
"TERMINOLOGY_CODE"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "TERMINOLOGY_CODE" {
__attrs.push(("xsi:type", "TERMINOLOGY_CODE".to_string()));
}
}
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.terminology_id
.write_xml(w, "terminology_id", Some(""))?;
self.code_string.write_xml(w, "code_string", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::TerminologyCode {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __terminology_id = None;
let mut __code_string = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"terminology_id" => {
__terminology_id =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"code_string" => {
__code_string = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "TERMINOLOGY_CODE".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::TerminologyCode {
terminology_id: __terminology_id
.ok_or_else(|| reader.missing_child("TERMINOLOGY_CODE", "terminology_id"))?,
code_string: __code_string
.ok_or_else(|| reader.missing_child("TERMINOLOGY_CODE", "code_string"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::TranslationDetails {
fn xml_type_name(&self) -> &'static str {
"TRANSLATION_DETAILS"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "TRANSLATION_DETAILS" {
__attrs.push(("xsi:type", "TRANSLATION_DETAILS".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
self.language.write_xml(w, "language", Some(""))?;
for (k, v) in &self.author {
w.write_kv_element("author", k, v)?;
}
if let Some(v) = &self.accreditation {
v.write_xml(w, "accreditation", Some(""))?;
}
if let Some(m) = &self.other_details {
for (k, v) in m {
w.write_kv_element("other_details", k, v)?;
}
}
if let Some(v) = &self.version_last_translated {
v.write_xml(w, "version_last_translated", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::TranslationDetails {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __language = None;
let mut __author = indexmap::IndexMap::new();
let mut __accreditation = None;
let mut __other_details = indexmap::IndexMap::new();
let mut __version_last_translated = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"language" => {
__language = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"author" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__author.insert(__k, __v);
}
"accreditation" => {
__accreditation =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"other_details" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__other_details.insert(__k, __v);
}
"version_last_translated" => {
__version_last_translated =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "TRANSLATION_DETAILS".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::TranslationDetails {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("TRANSLATION_DETAILS", "id"))?
.to_string(),
language: __language
.ok_or_else(|| reader.missing_child("TRANSLATION_DETAILS", "language"))?,
author: __author,
accreditation: __accreditation,
other_details: if __other_details.is_empty() {
None
} else {
Some(__other_details)
},
version_last_translated: __version_last_translated,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::Termbindingset {
fn xml_type_name(&self) -> &'static str {
"TermBindingSet"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "TermBindingSet" {
__attrs.push(("xsi:type", "TermBindingSet".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
if let Some(m) = &self.items {
for (k, v) in m {
w.write_kv_element("items", k, v)?;
}
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::Termbindingset {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __items = indexmap::IndexMap::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"items" => {
let __k = __c
.attr("id")
.ok_or_else(|| reader.missing_attribute("StringDictionaryItem", "id"))?
.to_string();
let __v: String = crate::xml::runtime::FromXml::from_xml(reader, &__c)?;
__items.insert(__k, __v);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "TermBindingSet".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::Termbindingset {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("TermBindingSet", "id"))?
.to_string(),
items: if __items.is_empty() {
None
} else {
Some(__items)
},
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2_model::types::ValueSet {
fn xml_type_name(&self) -> &'static str {
"VALUE_SET"
}
fn write_xml(
&self,
w: &mut crate::xml::runtime::XmlWriter,
tag: &str,
declared: Option<&str>,
) -> Result<(), crate::xml::runtime::XmlError> {
let mut __attrs: Vec<(&str, String)> = Vec::new();
if let Some(d) = declared {
if d != "VALUE_SET" {
__attrs.push(("xsi:type", "VALUE_SET".to_string()));
}
}
__attrs.push(("id", self.id.to_string()));
let mut __e = quick_xml::events::BytesStart::new(tag);
for (k, v) in &__attrs {
__e.push_attribute((*k, v.as_str()));
}
w.write_start(__e)?;
for v in &self.members {
v.write_xml(w, "members", Some(""))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2_model::types::ValueSet {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __members = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"members" => {
__members.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "VALUE_SET".to_owned(),
child: __c.name.clone(),
});
}
},
crate::xml::runtime::XmlEvent::End => break,
crate::xml::runtime::XmlEvent::Text(_) => {}
crate::xml::runtime::XmlEvent::Eof => {
return Err(crate::xml::runtime::XmlError::Parse(
"unexpected EOF".into(),
));
}
}
}
Ok(crate::aom2_model::types::ValueSet {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("VALUE_SET", "id"))?
.to_string(),
members: __members,
})
}
}