|
Home > Archive > BizTalk Server > February 2004 > XML Fille fails validation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
XML Fille fails validation
|
|
| Russ Larrivee 2004-02-08, 8:39 am |
| I have a relatively simple XML document with an optional
element, error_data. In the document definition I
specified that this element's min is 0 and max *.
Documents with the error_data element in it validate those
without the element fail. The reason is error_data was
missing.
Here's what a document that validates looks like:
<eslip_response>
<transaction>insert</transaction>
<eslip_status>
<accepted_status>N</accepted_status>
<shipment_number>AA18A56C</shipment_number>
<error_data>
<error_item>supplier_code and
shipment_number</error_item>
<error_description>supplier_code 023250 and
shipment_number AA18A56C combination already exists in the
DB for the current year</error_description>
</error_data>
</eslip_status>
</eslip_response>
This is what one that fails validaton looks like:
<eslip_response>
<transaction>insert</transaction>
<eslip_status>
<accepted_status>Y</accepted_status>
<shipment_number>AA18A55K</shipment_number>
<eps_id>384731</eps_id>
</eslip_status>
</eslip_response>
How do I convince Biztalk that error_data is an optional
element?
Regards,
Russ Larrivee
Below is the document definition:
<?xml version="1.0" ?>
- <!-- Generated by using BizTalk Editor on Thu, Jan 08
2004 03:06:16 PM
-->
- <!-- Copyright (c) Microsoft Corporation. All rights
reserved.
-->
- <Schema name="eslip_response"
b:BizTalkServerEditorTool_Version="1.5"
b:root_reference="eslip_response" b:standard="XML"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:b="urn:schemas-microsoft-com:BizTalkServer"
xmlns:d="urn:schemas-microsoft-com:datatypes">
<b:SelectionFields />
- <ElementType name="transaction" content="textOnly"
model="closed">
<b:FieldInfo />
</ElementType>
- <ElementType name="shipment_number" content="textOnly"
model="closed">
<b:FieldInfo />
</ElementType>
- <ElementType name="eslip_status" content="eltOnly"
model="closed">
<b:RecordInfo />
- <AttributeType name="eps_id">
<b:FieldInfo />
</AttributeType>
<element type="accepted_status" maxOccurs="1"
minOccurs="0" />
<element type="shipment_number" maxOccurs="1"
minOccurs="0" />
<attribute type="eps_id" required="no" />
<element type="error_data" maxOccurs="*"
minOccurs="0" />
</ElementType>
- <ElementType name="eslip_response" content="eltOnly"
model="closed">
<b:RecordInfo />
<element type="transaction" maxOccurs="1"
minOccurs="0" />
<element type="eslip_status" maxOccurs="1"
minOccurs="1" />
</ElementType>
- <ElementType name="error_item" content="textOnly"
model="closed">
<b:FieldInfo />
</ElementType>
- <ElementType name="error_description" content="textOnly"
model="closed">
<b:FieldInfo />
</ElementType>
- <ElementType name="error_data" content="eltOnly"
model="closed">
<b:RecordInfo />
<element type="error_item" maxOccurs="1"
minOccurs="0" />
<element type="error_description" maxOccurs="1"
minOccurs="0" />
</ElementType>
- <ElementType name="accepted_status" content="textOnly"
model="closed">
<b:FieldInfo />
</ElementType>
</Schema>
| |
| Jan Eliasen 2004-02-08, 8:39 am |
| On Thu, 8 Jan 2004 12:34:36 -0800, "Russ Larrivee"
<anonymous@discussions.microsoft.com> wrote:
Hi. Your problem seems to be that you have an "eps_id" FIELD in your
specification, but in your documentexample that doesn't validate,
eps_id is an element. Change the eps_id to be an element in the
specification, as you have done with "accepted_status" and you should
be fine.
>I have a relatively simple XML document with an optional
>element, error_data. In the document definition I
>specified that this element's min is 0 and max *.
>
>Documents with the error_data element in it validate those
>without the element fail. The reason is error_data was
>missing.
>
>Here's what a document that validates looks like:
>
><eslip_response>
> <transaction>insert</transaction>
><eslip_status>
> <accepted_status>N</accepted_status>
> <shipment_number>AA18A56C</shipment_number>
><error_data>
> <error_item>supplier_code and
>shipment_number</error_item>
> <error_description>supplier_code 023250 and
>shipment_number AA18A56C combination already exists in the
>DB for the current year</error_description>
> </error_data>
> </eslip_status>
> </eslip_response>
>
>This is what one that fails validaton looks like:
>
><eslip_response>
> <transaction>insert</transaction>
><eslip_status>
> <accepted_status>Y</accepted_status>
> <shipment_number>AA18A55K</shipment_number>
> <eps_id>384731</eps_id>
> </eslip_status>
> </eslip_response>
>
>How do I convince Biztalk that error_data is an optional
>element?
>
>Regards,
>
>Russ Larrivee
>
>Below is the document definition:
>
> <?xml version="1.0" ?>
>- <!-- Generated by using BizTalk Editor on Thu, Jan 08
>2004 03:06:16 PM
> -->
>- <!-- Copyright (c) Microsoft Corporation. All rights
>reserved.
> -->
>- <Schema name="eslip_response"
>b:BizTalkServerEditorTool_Version="1.5"
>b:root_reference="eslip_response" b:standard="XML"
>xmlns="urn:schemas-microsoft-com:xml-data"
>xmlns:b="urn:schemas-microsoft-com:BizTalkServer"
>xmlns:d="urn:schemas-microsoft-com:datatypes">
> <b:SelectionFields />
>- <ElementType name="transaction" content="textOnly"
>model="closed">
> <b:FieldInfo />
> </ElementType>
>- <ElementType name="shipment_number" content="textOnly"
>model="closed">
> <b:FieldInfo />
> </ElementType>
>- <ElementType name="eslip_status" content="eltOnly"
>model="closed">
> <b:RecordInfo />
>- <AttributeType name="eps_id">
> <b:FieldInfo />
> </AttributeType>
> <element type="accepted_status" maxOccurs="1"
>minOccurs="0" />
> <element type="shipment_number" maxOccurs="1"
>minOccurs="0" />
> <attribute type="eps_id" required="no" />
> <element type="error_data" maxOccurs="*"
>minOccurs="0" />
> </ElementType>
>- <ElementType name="eslip_response" content="eltOnly"
>model="closed">
> <b:RecordInfo />
> <element type="transaction" maxOccurs="1"
>minOccurs="0" />
> <element type="eslip_status" maxOccurs="1"
>minOccurs="1" />
> </ElementType>
>- <ElementType name="error_item" content="textOnly"
>model="closed">
> <b:FieldInfo />
> </ElementType>
>- <ElementType name="error_description" content="textOnly"
>model="closed">
> <b:FieldInfo />
> </ElementType>
>- <ElementType name="error_data" content="eltOnly"
>model="closed">
> <b:RecordInfo />
> <element type="error_item" maxOccurs="1"
>minOccurs="0" />
> <element type="error_description" maxOccurs="1"
>minOccurs="0" />
> </ElementType>
>- <ElementType name="accepted_status" content="textOnly"
>model="closed">
> <b:FieldInfo />
> </ElementType>
> </Schema>
--
Jan Eliasen, representing himself and not the company he works for
| |
| Russell Larrivee 2004-02-08, 8:39 am |
| Thanks. That fixed the problem.
Russ
>-----Original Message-----
>On Thu, 8 Jan 2004 12:34:36 -0800, "Russ Larrivee"
><anonymous@discussions.microsoft.com> wrote:
>
>Hi. Your problem seems to be that you have an "eps_id"
FIELD in your
>specification, but in your documentexample that doesn't
validate,
>eps_id is an element. Change the eps_id to be an element
in the
>specification, as you have done with "accepted_status"
and you should
>be fine.
>
those[color=blue]
the[color=blue]
content="textOnly"[color=blue]
>
>--
>Jan Eliasen, representing himself and not the company he
works for
>.
>
|
|
|
|
|