#![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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::types::AuthoredResource {
fn xml_type_name(&self) -> &'static str {
"AUTHORED_RESOURCE"
}
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_RESOURCE" {
__attrs.push(("xsi:type", "AUTHORED_RESOURCE".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"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::AuthoredResource {
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();
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)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "AUTHORED_RESOURCE".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::types::AuthoredResource {
original_language: __original_language
.ok_or_else(|| reader.missing_child("AUTHORED_RESOURCE", "original_language"))?,
is_controlled: __is_controlled,
description: __description,
translations: __translations,
uid: __uid,
annotations: __annotations,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::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::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::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::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::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::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::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::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::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::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::types::ExprItem {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2::types::ExprItem::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2::types::ExprItem::ExprLeaf(x) => x.xml_type_name(),
crate::aom2::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::types::ExprItem::ExprBinaryOperator(x) => x.write_xml(w, tag, declared),
crate::aom2::types::ExprItem::ExprLeaf(x) => x.write_xml(w, tag, declared),
crate::aom2::types::ExprItem::ExprUnaryOperator(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2::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::types::ExprItem::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_LEAF") => Ok(crate::aom2::types::ExprItem::ExprLeaf(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_UNARY_OPERATOR") => Ok(crate::aom2::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 persistent-form schemas (P_Archetype.xsd) define no EXPR_ITEM subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::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::types::ExprOperator {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2::types::ExprOperator::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2::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::types::ExprOperator::ExprBinaryOperator(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::ExprOperator::ExprUnaryOperator(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2::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::types::ExprOperator::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("EXPR_UNARY_OPERATOR") => Ok(crate::aom2::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 persistent-form schemas (P_Archetype.xsd) define no EXPR_OPERATOR subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::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::types::PArchetype {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_ARCHETYPE" {
__attrs.push(("xsi:type", "P_ARCHETYPE".to_string()));
}
}
if let Some(v) = &self.is_generated {
__attrs.push(("is_generated", 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.artefact_type.write_xml(w, "artefact_type", Some(""))?;
self.archetype_id
.write_xml(w, "archetype_id", Some("P_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("P_C_COMPLEX_OBJECT"))?;
for v in &self.rules {
v.write_xml(w, "rules", Some("ASSERTION"))?;
}
self.terminology
.write_xml(w, "terminology", Some("P_ARCHETYPE_TERMINOLOGY"))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PArchetype {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __artefact_type = None;
let mut __archetype_id = None;
let mut __parent_archetype_id = None;
let mut __definition = None;
let mut __rules = Vec::new();
let mut __terminology = None;
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"artefact_type" => {
__artefact_type =
Some(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)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PArchetype {
is_generated: start.attr("is_generated").map(|s| s.to_string()),
artefact_type: __artefact_type
.ok_or_else(|| reader.missing_child("P_ARCHETYPE", "artefact_type"))?,
archetype_id: __archetype_id
.ok_or_else(|| reader.missing_child("P_ARCHETYPE", "archetype_id"))?,
parent_archetype_id: __parent_archetype_id,
definition: __definition
.ok_or_else(|| reader.missing_child("P_ARCHETYPE", "definition"))?,
rules: __rules,
terminology: __terminology
.ok_or_else(|| reader.missing_child("P_ARCHETYPE", "terminology"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PArchetypeConstraint {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2::types::PArchetypeConstraint::PArchetypeSlot(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCArchetypeRoot(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCAttribute(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCBoolean(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCComplexObject(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCComplexObjectProxy(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCDate(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCDateTime(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCDefinedObject(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCDuration(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCInteger(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCPrimitiveObject(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCReal(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCString(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCTemporal(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCTerminologyCode(x) => x.xml_type_name(),
crate::aom2::types::PArchetypeConstraint::PCTime(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::types::PArchetypeConstraint::PArchetypeSlot(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCArchetypeRoot(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCAttribute(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCBoolean(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PArchetypeConstraint::PCComplexObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCComplexObjectProxy(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCDate(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PArchetypeConstraint::PCDateTime(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCDefinedObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCDuration(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCInteger(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PArchetypeConstraint::PCPrimitiveObject(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCReal(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PArchetypeConstraint::PCString(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PArchetypeConstraint::PCTemporal(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCTerminologyCode(x) => {
x.write_xml(w, tag, declared)
}
crate::aom2::types::PArchetypeConstraint::PCTime(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PArchetypeConstraint {
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("P_ARCHETYPE_SLOT") => {
Ok(crate::aom2::types::PArchetypeConstraint::PArchetypeSlot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_ARCHETYPE_ROOT") => {
Ok(crate::aom2::types::PArchetypeConstraint::PCArchetypeRoot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_ATTRIBUTE") => Ok(crate::aom2::types::PArchetypeConstraint::PCAttribute(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_BOOLEAN") => Ok(crate::aom2::types::PArchetypeConstraint::PCBoolean(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_COMPLEX_OBJECT") => {
Ok(crate::aom2::types::PArchetypeConstraint::PCComplexObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_COMPLEX_OBJECT_PROXY") => Ok(
crate::aom2::types::PArchetypeConstraint::PCComplexObjectProxy(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
),
),
Some("P_C_DATE") => Ok(crate::aom2::types::PArchetypeConstraint::PCDate(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_DATE_TIME") => Ok(crate::aom2::types::PArchetypeConstraint::PCDateTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_DEFINED_OBJECT") => {
Ok(crate::aom2::types::PArchetypeConstraint::PCDefinedObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_DURATION") => Ok(crate::aom2::types::PArchetypeConstraint::PCDuration(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_INTEGER") => Ok(crate::aom2::types::PArchetypeConstraint::PCInteger(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_PRIMITIVE_OBJECT") => {
Ok(crate::aom2::types::PArchetypeConstraint::PCPrimitiveObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_REAL") => Ok(crate::aom2::types::PArchetypeConstraint::PCReal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_STRING") => Ok(crate::aom2::types::PArchetypeConstraint::PCString(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_TEMPORAL") => Ok(crate::aom2::types::PArchetypeConstraint::PCTemporal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_TERMINOLOGY_CODE") => {
Ok(crate::aom2::types::PArchetypeConstraint::PCTerminologyCode(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_TIME") => Ok(crate::aom2::types::PArchetypeConstraint::PCTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
None => Err(crate::xml::runtime::XmlError::Parse(
"PArchetypeConstraint: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"PArchetypeConstraint: unknown xsi:type {other}: the ITS-XML AOM2 persistent-form schemas (P_Archetype.xsd) define no P_ARCHETYPE_CONSTRAINT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PArchetypeHrid {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_ARCHETYPE_HRID" {
__attrs.push(("xsi:type", "P_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()));
}
if let Some(v) = &self.physical_id {
__attrs.push(("physical_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.concept_id.write_xml(w, "concept_id", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PArchetypeHrid {
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: "P_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::types::PArchetypeHrid {
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()),
physical_id: start.attr("physical_id").map(|s| s.to_string()),
concept_id: __concept_id
.ok_or_else(|| reader.missing_child("P_ARCHETYPE_HRID", "concept_id"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PArchetypeSlot {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_ARCHETYPE_SLOT" {
__attrs.push(("xsi:type", "P_ARCHETYPE_SLOT".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_closed {
__attrs.push(("is_closed", 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"))?;
}
for v in &self.includes {
v.write_xml(w, "includes", Some("ASSERTION"))?;
}
for v in &self.excludes {
v.write_xml(w, "excludes", Some("ASSERTION"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PArchetypeSlot {
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 __includes = Vec::new();
let mut __excludes = 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)?);
}
"includes" => {
__includes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"excludes" => {
__excludes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PArchetypeSlot {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_closed: start.attr("is_closed").map(|s| s.to_string()),
sibling_order: __sibling_order,
includes: __includes,
excludes: __excludes,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PArchetypeTerminology {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_ARCHETYPE_TERMINOLOGY" {
__attrs.push(("xsi:type", "P_ARCHETYPE_TERMINOLOGY".to_string()));
}
}
if let Some(v) = &self.original_language {
__attrs.push(("original_language", 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.term_definitions {
v.write_xml(w, "term_definitions", Some("CodeDefinitionSet"))?;
}
for v in &self.terminology_extracts {
v.write_xml(w, "terminology_extracts", 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::types::PArchetypeTerminology {
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 __terminology_extracts = 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)?);
}
"terminology_extracts" => {
__terminology_extracts
.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: "P_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::types::PArchetypeTerminology {
original_language: start.attr("original_language").map(|s| s.to_string()),
term_definitions: __term_definitions,
terminology_extracts: __terminology_extracts,
term_bindings: __term_bindings,
value_sets: __value_sets,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PAuthoredArchetype {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_AUTHORED_ARCHETYPE" {
__attrs.push(("xsi:type", "P_AUTHORED_ARCHETYPE".to_string()));
}
}
if let Some(v) = &self.is_generated {
__attrs.push(("is_generated", v.to_string()));
}
if let Some(v) = &self.rm_release {
__attrs.push(("rm_release", v.to_string()));
}
if let Some(v) = &self.adl_version {
__attrs.push(("adl_version", 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.uid {
v.write_xml(w, "uid", Some(""))?;
}
self.original_language
.write_xml(w, "original_language", Some(""))?;
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"))?;
}
for v in &self.annotations {
v.write_xml(w, "annotations", Some("RESOURCE_ANNOTATIONS"))?;
}
self.artefact_type.write_xml(w, "artefact_type", Some(""))?;
self.archetype_id
.write_xml(w, "archetype_id", Some("P_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("P_C_COMPLEX_OBJECT"))?;
for v in &self.rules {
v.write_xml(w, "rules", Some("ASSERTION"))?;
}
self.terminology
.write_xml(w, "terminology", Some("P_ARCHETYPE_TERMINOLOGY"))?;
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::types::PAuthoredArchetype {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __uid = None;
let mut __original_language = None;
let mut __is_controlled = None;
let mut __description = None;
let mut __translations = Vec::new();
let mut __annotations = Vec::new();
let mut __artefact_type = None;
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 __other_metadata = indexmap::IndexMap::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"uid" => {
__uid = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"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)?);
}
"annotations" => {
__annotations.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"artefact_type" => {
__artefact_type =
Some(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)?);
}
"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: "P_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::types::PAuthoredArchetype {
is_generated: start.attr("is_generated").map(|s| s.to_string()),
rm_release: start.attr("rm_release").map(|s| s.to_string()),
adl_version: start.attr("adl_version").map(|s| s.to_string()),
uid: __uid,
original_language: __original_language
.ok_or_else(|| reader.missing_child("P_AUTHORED_ARCHETYPE", "original_language"))?,
is_controlled: __is_controlled,
description: __description,
translations: __translations,
annotations: __annotations,
artefact_type: __artefact_type
.ok_or_else(|| reader.missing_child("P_AUTHORED_ARCHETYPE", "artefact_type"))?,
archetype_id: __archetype_id
.ok_or_else(|| reader.missing_child("P_AUTHORED_ARCHETYPE", "archetype_id"))?,
parent_archetype_id: __parent_archetype_id,
definition: __definition
.ok_or_else(|| reader.missing_child("P_AUTHORED_ARCHETYPE", "definition"))?,
rules: __rules,
terminology: __terminology
.ok_or_else(|| reader.missing_child("P_AUTHORED_ARCHETYPE", "terminology"))?,
other_metadata: if __other_metadata.is_empty() {
None
} else {
Some(__other_metadata)
},
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCArchetypeRoot {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_ARCHETYPE_ROOT" {
__attrs.push(("xsi:type", "P_C_ARCHETYPE_ROOT".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", 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"))?;
}
for v in &self.attributes {
v.write_xml(w, "attributes", Some("P_C_ATTRIBUTE"))?;
}
for v in &self.attribute_tuples {
v.write_xml(w, "attribute_tuples", Some("P_C_ATTRIBUTE_TUPLE"))?;
}
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::types::PCArchetypeRoot {
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 __attributes = Vec::new();
let mut __attribute_tuples = 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)?);
}
"attributes" => {
__attributes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"attribute_tuples" => {
__attribute_tuples
.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: "P_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::types::PCArchetypeRoot {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
sibling_order: __sibling_order,
attributes: __attributes,
attribute_tuples: __attribute_tuples,
archetype_ref: __archetype_ref,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCAttribute {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_ATTRIBUTE" {
__attrs.push(("xsi:type", "P_C_ATTRIBUTE".to_string()));
}
}
if let Some(v) = &self.rm_attribute_name {
__attrs.push(("rm_attribute_name", v.to_string()));
}
if let Some(v) = &self.existence {
__attrs.push(("existence", v.to_string()));
}
if let Some(v) = &self.cardinality {
__attrs.push(("cardinality", v.to_string()));
}
if let Some(v) = &self.is_multiple {
__attrs.push(("is_multiple", 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.differential_path {
v.write_xml(w, "differential_path", Some(""))?;
}
for v in &self.children {
v.write_xml(w, "children", Some("P_C_OBJECT"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCAttribute {
fn from_xml(
reader: &mut crate::xml::runtime::XmlReader,
start: &crate::xml::runtime::StartTag,
) -> Result<Self, crate::xml::runtime::XmlError> {
let mut __differential_path = None;
let mut __children = Vec::new();
loop {
match reader.read()? {
crate::xml::runtime::XmlEvent::Start(__c) => match __c.name.as_str() {
"differential_path" => {
__differential_path =
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: "P_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::types::PCAttribute {
rm_attribute_name: start.attr("rm_attribute_name").map(|s| s.to_string()),
existence: start.attr("existence").map(|s| s.to_string()),
cardinality: start.attr("cardinality").map(|s| s.to_string()),
is_multiple: start.attr("is_multiple").map(|s| s.to_string()),
differential_path: __differential_path,
children: __children,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCAttributeTuple {
fn xml_type_name(&self) -> &'static str {
"P_C_ATTRIBUTE_TUPLE"
}
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 != "P_C_ATTRIBUTE_TUPLE" {
__attrs.push(("xsi:type", "P_C_ATTRIBUTE_TUPLE".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::types::PCAttributeTuple {
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: "P_C_ATTRIBUTE_TUPLE".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::types::PCAttributeTuple { members: __members })
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCBoolean {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_BOOLEAN" {
__attrs.push(("xsi:type", "P_C_BOOLEAN".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
for v in &self.constraint {
v.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::types::PCBoolean {
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 __assumed_value = None;
let mut __constraint = Vec::new();
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)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(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: "P_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::types::PCBoolean {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
assumed_value: __assumed_value,
constraint: __constraint,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCComplexObject {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_COMPLEX_OBJECT" {
__attrs.push(("xsi:type", "P_C_COMPLEX_OBJECT".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", 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"))?;
}
for v in &self.attributes {
v.write_xml(w, "attributes", Some("P_C_ATTRIBUTE"))?;
}
for v in &self.attribute_tuples {
v.write_xml(w, "attribute_tuples", Some("P_C_ATTRIBUTE_TUPLE"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCComplexObject {
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 __attributes = Vec::new();
let mut __attribute_tuples = 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)?);
}
"attributes" => {
__attributes.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"attribute_tuples" => {
__attribute_tuples
.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCComplexObject {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
sibling_order: __sibling_order,
attributes: __attributes,
attribute_tuples: __attribute_tuples,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCComplexObjectProxy {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_COMPLEX_OBJECT_PROXY" {
__attrs.push(("xsi:type", "P_C_COMPLEX_OBJECT_PROXY".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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"))?;
}
self.target_path.write_xml(w, "target_path", Some(""))?;
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCComplexObjectProxy {
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 __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)?);
}
"target_path" => {
__target_path = Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCComplexObjectProxy {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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,
target_path: __target_path
.ok_or_else(|| reader.missing_child("P_C_COMPLEX_OBJECT_PROXY", "target_path"))?,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCDate {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_DATE" {
__attrs.push(("xsi:type", "P_C_DATE".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
for v in &self.constraint {
v.write_xml(w, "constraint", Some("IntervalOfDate"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCDate {
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 __pattern_constraint = None;
let mut __constraint = 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)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCDate {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
pattern_constraint: __pattern_constraint,
constraint: __constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCDateTime {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_DATE_TIME" {
__attrs.push(("xsi:type", "P_C_DATE_TIME".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
for v in &self.constraint {
v.write_xml(w, "constraint", Some("IntervalOfDateTime"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCDateTime {
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 __pattern_constraint = None;
let mut __constraint = 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)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCDateTime {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
pattern_constraint: __pattern_constraint,
constraint: __constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCDefinedObject {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_DEFINED_OBJECT" {
__attrs.push(("xsi:type", "P_C_DEFINED_OBJECT".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", 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"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCDefinedObject {
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();
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)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCDefinedObject {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
sibling_order: __sibling_order,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCDuration {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_DURATION" {
__attrs.push(("xsi:type", "P_C_DURATION".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
for v in &self.constraint {
v.write_xml(w, "constraint", Some("IntervalOfDuration"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCDuration {
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 __pattern_constraint = None;
let mut __constraint = 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)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCDuration {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
pattern_constraint: __pattern_constraint,
constraint: __constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCInteger {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_INTEGER" {
__attrs.push(("xsi:type", "P_C_INTEGER".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
for v in &self.constraint {
v.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::types::PCInteger {
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 __assumed_value = None;
let mut __constraint = Vec::new();
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)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(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: "P_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::types::PCInteger {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
assumed_value: __assumed_value,
constraint: __constraint,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCObject {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2::types::PCObject::PArchetypeSlot(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCArchetypeRoot(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCBoolean(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCComplexObject(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCComplexObjectProxy(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCDate(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCDateTime(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCDefinedObject(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCDuration(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCInteger(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCPrimitiveObject(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCReal(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCString(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCTemporal(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCTerminologyCode(x) => x.xml_type_name(),
crate::aom2::types::PCObject::PCTime(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::types::PCObject::PArchetypeSlot(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCArchetypeRoot(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCBoolean(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCComplexObject(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCComplexObjectProxy(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCDate(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCDateTime(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCDefinedObject(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCDuration(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCInteger(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCPrimitiveObject(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCReal(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCString(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCTemporal(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCTerminologyCode(x) => x.write_xml(w, tag, declared),
crate::aom2::types::PCObject::PCTime(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCObject {
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("P_ARCHETYPE_SLOT") => Ok(crate::aom2::types::PCObject::PArchetypeSlot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_ARCHETYPE_ROOT") => Ok(crate::aom2::types::PCObject::PCArchetypeRoot(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_BOOLEAN") => Ok(crate::aom2::types::PCObject::PCBoolean(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_COMPLEX_OBJECT") => Ok(crate::aom2::types::PCObject::PCComplexObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_COMPLEX_OBJECT_PROXY") => {
Ok(crate::aom2::types::PCObject::PCComplexObjectProxy(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("P_C_DATE") => Ok(crate::aom2::types::PCObject::PCDate(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_DATE_TIME") => Ok(crate::aom2::types::PCObject::PCDateTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_DEFINED_OBJECT") => Ok(crate::aom2::types::PCObject::PCDefinedObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_DURATION") => Ok(crate::aom2::types::PCObject::PCDuration(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_INTEGER") => Ok(crate::aom2::types::PCObject::PCInteger(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_PRIMITIVE_OBJECT") => Ok(crate::aom2::types::PCObject::PCPrimitiveObject(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_REAL") => Ok(crate::aom2::types::PCObject::PCReal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_STRING") => Ok(crate::aom2::types::PCObject::PCString(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_TEMPORAL") => Ok(crate::aom2::types::PCObject::PCTemporal(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_TERMINOLOGY_CODE") => Ok(crate::aom2::types::PCObject::PCTerminologyCode(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("P_C_TIME") => Ok(crate::aom2::types::PCObject::PCTime(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
None => Err(crate::xml::runtime::XmlError::Parse(
"PCObject: missing xsi:type".into(),
)),
Some(other) => Err(crate::xml::runtime::XmlError::Parse(format!(
"PCObject: unknown xsi:type {other}: the ITS-XML AOM2 persistent-form schemas (P_Archetype.xsd) define no P_C_OBJECT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCPrimitiveObject {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_PRIMITIVE_OBJECT" {
__attrs.push(("xsi:type", "P_C_PRIMITIVE_OBJECT".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCPrimitiveObject {
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();
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)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCPrimitiveObject {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCReal {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_REAL" {
__attrs.push(("xsi:type", "P_C_REAL".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
for v in &self.constraint {
v.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::types::PCReal {
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 __assumed_value = None;
let mut __constraint = Vec::new();
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)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(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: "P_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::types::PCReal {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
assumed_value: __assumed_value,
constraint: __constraint,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCString {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_STRING" {
__attrs.push(("xsi:type", "P_C_STRING".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.assumed_value {
v.write_xml(w, "assumed_value", Some(""))?;
}
for v in &self.constraint {
v.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::types::PCString {
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 __assumed_value = None;
let mut __constraint = Vec::new();
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)?);
}
"assumed_value" => {
__assumed_value =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(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: "P_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::types::PCString {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
assumed_value: __assumed_value,
constraint: __constraint,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCTemporal {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_TEMPORAL" {
__attrs.push(("xsi:type", "P_C_TEMPORAL".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCTemporal {
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();
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)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCTemporal {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCTerminologyCode {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_TERMINOLOGY_CODE" {
__attrs.push(("xsi:type", "P_C_TERMINOLOGY_CODE".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.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::types::PCTerminologyCode {
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 __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)?);
}
"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: "P_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::types::PCTerminologyCode {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
assumed_value: __assumed_value,
constraint: __constraint
.ok_or_else(|| reader.missing_child("P_C_TERMINOLOGY_CODE", "constraint"))?,
default_value: __default_value,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::types::PCTime {
fn xml_type_name(&self) -> &'static str {
"P_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 != "P_C_TIME" {
__attrs.push(("xsi:type", "P_C_TIME".to_string()));
}
}
if let Some(v) = &self.occurrences {
__attrs.push(("occurrences", v.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()));
}
if let Some(v) = &self.is_frozen {
__attrs.push(("is_frozen", v.to_string()));
}
if let Some(v) = &self.is_enumerated_type_constraint {
__attrs.push(("is_enumerated_type_constraint", 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.pattern_constraint {
v.write_xml(w, "pattern_constraint", Some(""))?;
}
for v in &self.constraint {
v.write_xml(w, "constraint", Some("IntervalOfTime"))?;
}
w.write_end(tag)?;
Ok(())
}
}
impl crate::xml::runtime::FromXml for crate::aom2::types::PCTime {
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 __pattern_constraint = None;
let mut __constraint = 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)?);
}
"pattern_constraint" => {
__pattern_constraint =
Some(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
"constraint" => {
__constraint.push(crate::xml::runtime::FromXml::from_xml(reader, &__c)?);
}
_ => {
return Err(crate::xml::runtime::XmlError::UndeclaredChild {
owner: "P_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::types::PCTime {
occurrences: start.attr("occurrences").map(|s| s.to_string()),
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()),
is_frozen: start.attr("is_frozen").map(|s| s.to_string()),
is_enumerated_type_constraint: start
.attr("is_enumerated_type_constraint")
.map(|s| s.to_string()),
sibling_order: __sibling_order,
pattern_constraint: __pattern_constraint,
constraint: __constraint,
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::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::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::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::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::types::RuleElement {
fn xml_type_name(&self) -> &'static str {
match self {
crate::aom2::types::RuleElement::Assertion(x) => x.xml_type_name(),
crate::aom2::types::RuleElement::ExprBinaryOperator(x) => x.xml_type_name(),
crate::aom2::types::RuleElement::ExprLeaf(x) => x.xml_type_name(),
crate::aom2::types::RuleElement::ExprUnaryOperator(x) => x.xml_type_name(),
crate::aom2::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::types::RuleElement::Assertion(x) => x.write_xml(w, tag, declared),
crate::aom2::types::RuleElement::ExprBinaryOperator(x) => x.write_xml(w, tag, declared),
crate::aom2::types::RuleElement::ExprLeaf(x) => x.write_xml(w, tag, declared),
crate::aom2::types::RuleElement::ExprUnaryOperator(x) => x.write_xml(w, tag, declared),
crate::aom2::types::RuleElement::RuleStatement(x) => x.write_xml(w, tag, declared),
}
}
}
impl crate::xml::runtime::FromXml for crate::aom2::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::types::RuleElement::Assertion(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_BINARY_OPERATOR") => {
Ok(crate::aom2::types::RuleElement::ExprBinaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
))
}
Some("EXPR_LEAF") => Ok(crate::aom2::types::RuleElement::ExprLeaf(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("EXPR_UNARY_OPERATOR") => Ok(crate::aom2::types::RuleElement::ExprUnaryOperator(
crate::xml::runtime::FromXml::from_xml(reader, start)?,
)),
Some("RULE_STATEMENT") => Ok(crate::aom2::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 persistent-form schemas (P_Archetype.xsd) define no RULE_ELEMENT subtype of that name"
))),
}
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::types::RuleStatement {
r#type: start.attr("type").map(|s| s.to_string()),
})
}
}
impl crate::xml::runtime::ToXml for crate::aom2::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::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::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::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::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::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::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::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::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::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::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::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::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::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::types::ValueSet {
id: start
.attr("id")
.ok_or_else(|| reader.missing_attribute("VALUE_SET", "id"))?
.to_string(),
members: __members,
})
}
}