开发者

Automatically truncate to MaxLength during mapping

I have a schema that has the max length property set on all of its elements, of various size. I am mapping to it and expect that the max length will be exceeded quite often.

Is there a way tell BizTalk to automatically truncate without having to go in and manually configure a functoid for each element?

Is 开发者_StackOverflowthere a purpose for the max length property other than validation?


There is no functionality to do what you want in the BizTalk mapper - you could certainly write some sort of pre or post processor that would do this but I'd suggest you are going down the wrong path.

It will take more work but I'd advise investigating why your source and target systems have such different schemas. It is probably a warning sign that you want to truncate so many fields to be able to pass information on.

It will be well worth your time to work out:

  • Are these maxLength elements all strictly necessary?
  • Will truncation of any of your fields cause issues, either technically or to business users?
  • Should some of these fields instead be being split up? Perhaps one system defines a single 100 character address field, while the other system has a street and a town field.

The maxLength property defines how long an element content can be. So yes, it's only purpose is to provide additional validation rules for your schema.

From the W3C XML Schema definition:

maxLength· provides for:

•Constraining a ·value space· to values with at most a specific number of units of length, where units of length varies depending on {base type definition}.

I prefer the word they use constraining over the word validation - to me this more clearly expresses the concept of your XML schema being a contract that defines what your system will be passing to other systems. Facets like maxLength say (to the reader of the schema) that systems hoping to consume this data may well break if they are passed anything longer than the maxLength.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜