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 » XML declaration

Post new topic  Reply to topic Goto page 1, 2  Next
 XML declaration « View previous topic :: View next topic » 
Author Message
angka
PostPosted: Mon Oct 09, 2006 11:42 pm    Post subject: XML declaration Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Why when I mapped MRM to XML using the Mapping node the XML message data does not have the xml declaration? I din check the "Suppress XML Declaration" check box in the message set Physical properties. Or do I need to add in using compute node? Thanks
Back to top
View user's profile Send private message
Edde
PostPosted: Tue Oct 10, 2006 12:15 am    Post subject: Reply with quote

Acolyte

Joined: 01 Oct 2006
Posts: 67
Location: Moscow, Russia

How you determine that XML message does not have XML declaration?
There is no declaration after you place output message to a queue?
Back to top
View user's profile Send private message
shanson
PostPosted: Tue Oct 10, 2006 12:41 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

The 'Suppress XML Declaration' option only applies to the MRM domain - it's an MRM XML physical format property. The output from your Mapping node is in XML domain, and there is currently no facility to add an XML declaration in the mapper.

So you will need to add the XML declaration yourself prior to output, using a Compute node.
Back to top
View user's profile Send private message
angka
PostPosted: Tue Oct 10, 2006 12:58 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Oh ok thanks. that is what I did now. Tot there maybe a better way. but why when i code
OutputRoot.XML.Exception.a = 'a';
OutputRoot.XML.Exception.b = 'b';
the XML declaration is automatically generated.

Cheers.
Back to top
View user's profile Send private message
angka
PostPosted: Mon Oct 16, 2006 2:34 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

then how can i add the XML namespace? can i use the message set namespace properties? it doesnt work for me. or do i need to add using compute node too? thanks..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 16, 2006 2:53 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Use the MRM domain and the message set namespace or use the XMLNS domain and make sure to use the namespace declarations:

DECLARE myns NAMESPACE 'urn:mycompany.com/ns/myns';

SET myref.myns:myfield='myfieldvaluehere';

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Oct 16, 2006 4:49 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

angka: I think you mean 'XML namespace declaration' not 'XML declaration'.
An XML declaration always occurs at the start of the document ( if at all ), and looks like this:

<?xml version="1.0"?>

An XML namespace declaration can occur once on any element. It defines a namespace prefix and looks like this:

<element1 xmlns:prefix1="http://mynamespace" prefix1:myAttr="myValue">

Now that you understand that, you should be aware that
- The MRM XML message set property 'Suppress XML Declaration' has nothing to do with your problem.
- The MRM XML message set properties contains a table which allows you to define one 'preferred prefix' for each namespace in your output document.
- The XML/XMLNS/XMLNSC domains handle namespace declarations in a completely different way. The docs contain plenty of examples.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Oct 16, 2006 4:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

one more thing: if you want to be a good citizen, you should edit the title of this thread to 'XML namespace declarations'
Back to top
View user's profile Send private message
angka
PostPosted: Mon Oct 16, 2006 7:39 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

kimbert: sorry bout tt.. i was asking bout XML declaration at 1st but then i solved it ... and since it is quite similiar i used back this thread...

thanx all
Back to top
View user's profile Send private message
angka
PostPosted: Mon Oct 16, 2006 9:33 pm    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

I defined the prefix and namespace in the message set properties table but the output of the XML message did not include the namespace.

I am using the mapping node mapping from physical format CWF (parse to MRM) to output XML.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Oct 17, 2006 12:42 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Not enough information to diagnose the problem.
- Post a trace of the message tree just before the output node.
- Tell us what output message you were expecting
- Tell us what output message you got.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 17, 2006 2:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Usually if you have imported something like a copybook (CWF) you cannot just parse it and output it with namespaces in xml.
You would have to map it first to a namespace aware message set.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
angka
PostPosted: Wed Oct 18, 2006 2:35 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Sorry for the vague description. Below is what i wanna achieve

When my message flow pick up from local queue the messge data is in CWF format. Then in my compute node i parse it to MRM domain and then it go thru a mapping node. the output message from the mapping node uses message set using XMLNS domain . it den go into another compute node. i set the xml declaration and namespace here. below are my code.

SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.IncidentEvent.(XML.NamespaceDecl).Xmlns:xsi = ' http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.IncidentEvent.(XML.NamespaceDecl).Xmlns:xsd = ' http://www.w3.org/2001/XMLSchema';

I got the following error when it try to put to a MQOutput node.
"Element must have a namespace specified if there is a default namespace in scope"

Is the error due to i setting 2 namespaces? but if so then how can i set 2 namespaces in one element?

btw am i right to say that the properties in the message set for namespace and XML declarations are for MRM domain??

Thanks..
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Oct 18, 2006 3:52 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
"Element must have a namespace specified if there is a default namespace in scope"
Your message tree is incorrect. Somewhere in the message tree you have defined a default namespace (see comment at the end of this post). Somewhere else in that message tree there is an element in noTargetNamespace. The XML serialization logic cannot possibly output anything sensible, so it throws this error.
Quote:
Is the error due to i setting 2 namespaces? but if so then how can i set 2 namespaces in one element?
No, it is not. But you are not setting namespaces. You are declaring prefixes for namespaces. You can declare 100 prefixes for 100 different namespaces on the same element if you really want to.
Quote:
btw am i right to say that the properties in the message set for namespace and XML declarations are for MRM domain??
That is correct.

Not sure whether you posted the correct code, but you should be using 'xmlns' not 'Xmlns'. I would change that and re-test before trying anything else.
Back to top
View user's profile Send private message
angka
PostPosted: Fri Oct 20, 2006 2:24 am    Post subject: Reply with quote

Chevalier

Joined: 20 Sep 2005
Posts: 406

Hi,

Sorry, i type wrongly i am using 'xmlns' =)

and i didnt include one of the line...

SET OutputRoot.XMLNS.IncidentEvent.(XML.NamespaceDecl).xmlns:xsi = ' http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.IncidentEvent.(XML.NamespaceDecl).xmlns:xsd = ' http://www.w3.org/2001/XMLSchema';
SET OutputRoot.XMLNS.IncidentEvent.(XML.NamespaceDecl).xmlns = 'http://tempuri.org/XSDSchema.xsd';

what should I do to include xmlns = 'http://tempuri.org/XSDSchema.xsd' to the element? thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML declaration
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.