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 IndexWebSphere Message Broker Supportesql namespaces xmlnsc

Post new topicReply to topic
esql namespaces xmlnsc View previous topic :: View next topic
Author Message
paustin_ours
PostPosted: Wed Jun 24, 2020 4:49 am Post subject: esql namespaces xmlnsc Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 641
Location: columbus,oh

I know this topic has been discussed in the past and I have tried multiple suggestions from infocenter and posts here but not able to get it to work

I am trying to create an xml messages out of my compute node like below


Quote:

<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="4.00"
xsi:noNamespaceSchemaLocation="FileTransfer.xsd">
<managedTransfer>
<originator>
<hostName>example.com.</hostName>
<userID>mqm</userID>
</originator>
<sourceAgent QMgr="QM_JUPITER" agent="AGENT_JUPITER"/>
<destinationAgent QMgr="QM_JUPITER" agent="AGENT_JUPITER"/>
<transferSet>
<item checksumMethod="MD5" mode="binary">
<source disposition="leave" recursive="false">
<file>/etc/passwd</file>
</source>
<destination exist="overwrite" type="directory">
<file>/tmp</file>
</destination>
</item>
</transferSet>
</managedTransfer>
</request>


I am currently at this esql after trying many things

Code:

CREATE FIRSTCHILD OF OutputRoot.XMLNSC TYPE XMLNSC.XmlDeclaration NAME 'XmlDeclaration';
    SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
   SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
    --DECLARE xmlns NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
    --DECLARE xsi NAMESPACE 'FileTransfer.xsd';
   
    DECLARE space1 NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
    DECLARE xsi NAMESPACE '';
    SET OutputRoot.XMLNSC.space1:request.(XMLNSC.NamespaceDecl)xmlns:"xsi" = 'http://www.w3.org/2001/XMLSchema-instance';
    SET OutputRoot.XMLNSC.space1:request.(XMLNSC.Attribute)version = '4.00';
    SET OutputRoot.XMLNSC.space1:request.(XMLNSC.NamespaceDecl)xsi:noNamespaceSchemaLocation = 'FileTransfer.xsd';
    --SET OutputRoot.XMLNSC.xsi.request.(XMLNSC.Attribute)noNamespaceSchemaLocation = 'FileTransfer.xsd';
    SET OutputRoot.XMLNSC.space1:request.space1:managedTransfer.space1:originator.space1:hostName = 'example.com';
    SET OutputRoot.XMLNSC.space1:request.space1:managedTransfer.space1:originator.space1:userID = 'mqm';
   


this is generating an xml like this



Quote:

<?xml version="1.0" encoding="UTF-8"?>
<xsi:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="4.00" noNamespaceSchemaLocation="FileTransfer.xsd">
<xsi:managedTransfer>
<xsi:originator>
<xsi:hostName>example.com</xsi:hostName>
<xsi:userID>mqm</xsi:userID>
</xsi:originator>
</xsi:managedTransfer>
</xsi:request>


how to I get rid of the xsi prefix tht show up in each xml tag

also not sure how to get the xsi:noNamespaceSchemalocation

please shed some light. thanks.
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Wed Jun 24, 2020 5:11 am Post subject: Re: esql namespaces xmlnsc Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25995
Location: Texas, USA

paustin_ours wrote:
how to I get rid of the xsi prefix tht show up in each xml tag


Don't add them to the xsi namespace (which you're explicitly doing in your code)

paustin_ours wrote:
also not sure how to get the xsi:noNamespaceSchemalocation


Aside from the one you've got in your posted output, syntactically identical to your desired output?

paustin_ours wrote:
please shed some light.


Don't copy and paste random suggestions from the Infocenter. Take a breath and think about what your code is doing. Look at the required XML and see which tags are where.

If it helps, try putting the MFT tags explicitly in the correct namespace. Remember that all the prefixes do is indicate to the XML parser which namespace a given tag belongs to, so 2 documents where one allows tags to default and another explicitly defines a namespace for each tag are syntactically identical.

Even if they don't look the same to a human reader.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paustin_ours
PostPosted: Wed Jun 24, 2020 5:25 am Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 641
Location: columbus,oh

if I remove the reference to xsi name space

SET OutputRoot.XMLNSC.space1:request.(XMLNSC.NamespaceDecl)xmlns = 'http://www.w3.org/2001/XMLSchema-instance';

my output shows like this

Quote:

<?xml version="1.0" encoding="UTF-8"?>
<request xmlns="http://www.w3.org/2001/XMLSchema-instance" version="4.00" xmlns:noNamespaceSchemaLocation="FileTransfer.xsd">
<managedTransfer>
<originator>
<hostName>example.com</hostName>
<userID>mqm</userID>
</originator>
</managedTransfer>
</request>


but this is not what I want though.
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Wed Jun 24, 2020 7:27 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25995
Location: Texas, USA

paustin_ours wrote:
this is not what I want though.


So code it how you want it.

I stand by my previous advice; think about what you want, then code for that. Do not add or remove lines randomly in the hopes of hitting the magic combination that makes the XML look like the example you're trying to match.

I also repeat my comments about 2 non-identical XML documents being syntactically equivalent.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
timber
PostPosted: Thu Jun 25, 2020 1:00 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1120

Vitor is 100% correct. You have probably convinced yourself that XML namespaces are difficult. But you are a programmer, and you have learned a lot more difficult things than XML namespaces.

I strongly encourage you to slay this dragon and lose your fear of the subject area. Do a few experiments, or take a w3schools course on XML namespaces. It's really not hard.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker Supportesql namespaces 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.