TN/schema validate where it should fail

I have an XML posted to our Site, it looks like the customer cut it and post it from IE ( it has minus signs outside of the elements tags), and it cause an error beyond WM

  • for XMLSPY its not a well formed XML

  • For TN its a good XML that I used to define docType
    and then test it for recognition without any issue

  • For Developer the validate schema has no errors despite the minus signs

The issue is that, for partners who will get the minus sign will not be able to handle it if they don’t have WM
Any idea how to make validation fail, or remove these extras.

Thanks,
Mohammad.

To recreate the issue → I have created a sample, “based on the schema listed at the end”
And that sample passed validation

  <?xml version="1.0" encoding="UTF-8" ?> 
- <!-- Sample XML file generated by XMLSPY v2004 rel. 3 U ([URL="http://www.xmlspy.com"]http://www.xmlspy.com[/URL])
  --> 
- <SampleDoc xmlns="urn:transaction-schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:transaction-schema C:\temp\SampleSchema.xsd">
- <Information>
  <Name>SoemOneName</Name> 
  <Address>1600 International Dr</Address> 
  </Information>
  </SampleDoc>

and I used it to create a TN DocumentType and then test it, and it passed the recognition without any problem ( version is 6.5)

here is the schema
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=“XML Schema” xmlns=“urn:transaction-schema” elementFormDefault=“qualified” targetNamespace=“urn:transaction-schema”>
<xs:simpleType name=“FNameType”>
<xs:restriction base=“xs:string”>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name=“AddressType”>
<xs:restriction base=“xs:string”>
</xs:restriction>
</xs:simpleType>
<xs:complexType name=“InformationType”>
xs:sequence
<xs:element name=“Name” type=“FNameType” minOccurs=“1” maxOccurs=“1”/>
<xs:element name=“Address” type=“AddressType” minOccurs=“1” maxOccurs=“1”/>
</xs:sequence>
</xs:complexType>
<xs:element name=“SampleDoc”>
xs:complexType
xs:sequence
<xs:element name=“Information” type=“InformationType” minOccurs=“1” maxOccurs=“10”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

I did a quick test by pasting your sample doc into a pub.xml:xmlStringToNode service and then used pub.xml:xmlNodeToDocument to attempt to create an IS doc type from the node.

IS is apparently able to handle the noise characters “+” and “-” and create a valid node (parsed document) from your sample. The node can be used to create a valid doc type.

Since you are able to create a valid IS document type, just create the XML string from that doc type and not from the raw XML as original posted. When you create a new XML string from the doc type, it will not contain the noise characters.

HTH,

Mark

Many Thanks, That worked perfectly, However I was hoping that I can find a way to invalidate the XML either from TN or Developer since this issue is related to some Sync orders, I was thinking by adding these steps there might be some performance impacts, specially when the “noise” characters issue is a very rare scenario.

string to node
node to document
document to string

Thanks.