Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
552 views
in Technique[技术] by (71.8m points)

websphere - Create new Object from XSD in ESQL

Is there a way to create an object whose format is defined in a message model?

Actually, I have created a message model with some fields containing default values and some restrictions. I managed with the following code to create a message in ESQL, but the other fields (which contain default values) do not appear :

CREATE LASTCHILD OF OutputRoot DOMAIN('DFDL');
-- SET OutputRoot.Properties = InputRoot.Properties;      
SET OutputRoot.Properties.MessageSet = '{ObjectsDefinitionLibrary}';
SET OutputRoot.Properties.MessageType = '{}:Example1MsgModel';
SET OutputRoot.DFDL.Example1MsgModel.record[1].FieldOne = 'Value1';

Will this be possible with ESQL?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Is there a way to create an object whose format is defined in a message model

You need to define what you mean by 'object'. Do you want to create a message tree based on the model? Or do you want to generate a valid BLOB from the model?

As has been said by others, if you want to generate a BLOB from a DFDL model, you must ensure that everything in the message model (including complex elements) has minOccurs>=1, and you must provide a default value for every field. If you want a message tree then you will need to parse that BLOB using the DFDL parser. Which leads nicely into the answer to your other question...

Will this be possible with ESQL?

ESQL does not offer a special statement to create a message tree from a model. However, it does offer two functions for parsing and writing any BLOB/message tree. Look up the ASBITSTREAM function, and the CREATE function (with the PARSE clause).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...