ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Auto generation of default value in xsd using XMLNSC

Post new topic  Reply to topic
 Auto generation of default value in xsd using XMLNSC « View previous topic :: View next topic » 
Author Message
angka
PostPosted: Thu Nov 17, 2011 2:46 am    Post subject: Auto generation of default value in xsd using XMLNSC Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Is there a way to auto generate the element with default value of the xsd if the xml does not have the element using XMLNSC with validation on?

Below is what I did:
I created a xsd with 5 elements with minoccur=1 and default value set. i import as mxsd. I have a simple flow with input, compute, resetcontentdescriptor and output node.

In the compute node:
I set outputroot.xmlnsc.ns1:root:ns1:ele1 = '5';

In the resetcontentdescriptor node:
I set the domain as 'xmlnsc', the message set and turn on validation as 'content and value'

I run the flow and get erorr 'the content of element ns1:root is not complete'

I thought with validation on, broker will validate against the xsd and create those elements with default value from the xsd if it is not in the outputroot tree?

Below is extract from message model redbook:
Local element logical properties
XMLNSC domain
When parsing with validation enabled, default values are applied to
missing attributes and empty elements as required by the XML Schema
1.0 specification. When writing, elements or attributes that are missing
from the message tree are not automatically added to the output XML
bit stream, even if they have default values. If missing elements or
attributes are required, the message tree can be serialized and then
re-parsed with validation enabled.
Back to top
View user's profile Send private message
saurabh867
PostPosted: Thu Nov 17, 2011 3:24 am    Post subject: Reply with quote

Voyager

Joined: 13 Jun 2010
Posts: 78

Hi,
Did you create the empty elements? As per the documentation, empty elements should be created then it would populate the default values but I think you are not creating the elements itself which may cause schema failure as the elements may be mandatory.

Quote:
When parsing with validation enabled, default values are applied to
missing attributes and empty elements as required by the XML Schema
1.0 specification.

Regards,
Saurabh
Back to top
View user's profile Send private message
angka
PostPosted: Thu Nov 17, 2011 3:53 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Ya, I did not create an empty element but the last sentence state this:
If missing elements or attributes are required, the message tree can be serialized and then re-parsed with validation enabled.

Thanks
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 17, 2011 5:24 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I think the words in the info center could be better. They should say:
Quote:
If required attributes with default values are missing from the message tree then they can be added automatically by writing the message tree and re-parsing with validation enabled.
If required simple elements are present in the message tree with no value or with the empty string as their value then the default value can be automatically assigned to these elements writing the message tree and re-parsing with validation enabled.
Quite a lot harder to read, but more accurate.
Back to top
View user's profile Send private message
angka
PostPosted: Thu Nov 17, 2011 6:04 pm    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Got it.. thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Auto generation of default value in xsd using XMLNSC
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.