Author |
Message
|
RAIQ |
Posted: Tue Jun 22, 2004 1:51 am Post subject: New XML-Struct to OutputRoot with XMLNS |
|
|
Novice
Joined: 06 Feb 2003 Posts: 23 Location: Switzerland
|
I get a message with 3 namespaces: default, appl1 and appl2. now, i like to add a new xml-struct to the message with the namespace-qualifier appl1
input:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<RaiqMeldung xmlns="http://www.xxx.ch/xml/ods" xmlns:d2000="http://www.xxx.ch/xml/d2000"
xmlns:raiq="http://www.xxx.ch/xml/raiq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.ch/xml/ods D:\xxx\xxx_00_03.xsd">
<raiq:RaiqHeader>
</raiq:RaiqHeader>
<OdsMeldung>
<OdsHeader>
<MeldungSeqNr>0</MeldungSeqNr>
<SyncNr>0</SyncNr>
<MeldungArt>0</MeldungArt>
</OdsHeader>
<OdsBusinessDaten>
<LieferArt>I</LieferArt>
<OdsBusinessDatenDetail>
<d2000:RW_KONTO_LIST>
</d2000:RW_KONTO_LIST>
</OdsBusinessDatenDetail>
</OdsBusinessDaten>
</OdsMeldung>
</RaiqMeldung> |
and i want this output
add the RaiqError XML-Struct with
Code: |
SET theTree.RaiqError.Exception = ExceptionList;
SET theTree.RaiqError.ErrorType = ErrorType;
SET theTree.RaiqError.Severity = 'CRITICAL';
SET theTree.RaiqError.Reason = '';
SET theTree.RaiqError.Flow = FlowName;
SET theTree.RaiqError.Node = ''; : |
Quote: |
<?xml version="1.0" encoding="UTF-8"?>
<RaiqMeldung xmlns="http://www.xxx.ch/xml/ods" xmlns:d2000="http://www.xxx.ch/xml/d2000"
xmlns:raiq="http://www.xxx.ch/xml/raiq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.ch/xml/ods D:\xxx\xxx_00_03.xsd">
<raiq:RaiqHeader>
</raiq:RaiqHeader>
<OdsMeldung>
<OdsHeader>
<MeldungSeqNr>0</MeldungSeqNr>
<SyncNr>0</SyncNr>
<MeldungArt>0</MeldungArt>
</OdsHeader>
<OdsBusinessDaten>
<LieferArt>I</LieferArt>
<OdsBusinessDatenDetail>
<d2000:RW_KONTO_LIST>
</d2000:RW_KONTO_LIST>
</OdsBusinessDatenDetail>
</OdsBusinessDaten>
</OdsMeldung>
<raiq:RaiqError>
...
</raiq:RaiqError>
</RaiqMeldung> |
any idea of the right esql?
-----------------------------------
Björn |
|
Back to top |
|
 |
TonyD |
Posted: Tue Jun 22, 2004 3:23 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
This:
Code: |
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
DECLARE raiq NAMESPACE 'http://www.xxx.ch/xml/raiq';
DECLARE ods NAMESPACE 'http://www.xxx.ch/xml/ods';
DECLARE ExceptionList CHARACTER 'AAA';
DECLARE ErrorType CHARACTER 'BBB';
DECLARE FlowName CHARACTER;
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Exception = ExceptionList;
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:ErrorType = ErrorType;
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Severity = 'CRITICAL';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Reason = '';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Flow = FlowName;
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Node = '';
END;
|
:will produce this:
Quote: |
<?xml version="1.0" encoding="UTF-8"?>
<RaiqMeldung xmlns="http://www.xxx.ch/xml/ods" xmlns:d2000="http://www.xxx.ch/xml/d2000" xmlns:raiq="http://www.xxx.ch/xml/raiq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.ch/xml/ods D:\xxx\xxx_00_03.xsd">
<raiq:RaiqHeader> </raiq:RaiqHeader>
<OdsMeldung>
<OdsHeader>
<MeldungSeqNr>0</MeldungSeqNr>
<SyncNr>0</SyncNr>
<MeldungArt>0</MeldungArt>
</OdsHeader>
<OdsBusinessDaten>
<LieferArt>I</LieferArt>
<OdsBusinessDatenDetail>
<d2000:RW_KONTO_LIST> </d2000:RW_KONTO_LIST>
</OdsBusinessDatenDetail>
</OdsBusinessDaten>
</OdsMeldung>
<raiq:RaiqError>
<raiq:Exception>AAA</raiq:Exception>
<raiq:ErrorType>BBB</raiq:ErrorType>
<raiq:Severity>CRITICAL</raiq:Severity>
<raiq:Reason></raiq:Reason>
<raiq:Node></raiq:Node>
</raiq:RaiqError>
</RaiqMeldung>
|
|
|
Back to top |
|
 |
TonyD |
Posted: Tue Jun 22, 2004 5:03 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
TonyD wrote: |
This:
Code: |
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
DECLARE raiq NAMESPACE 'http://www.xxx.ch/xml/raiq';
DECLARE ods NAMESPACE 'http://www.xxx.ch/xml/ods';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Exception = 'ExceptionList';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:ErrorType = 'ErrorType';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Severity = 'CRITICAL';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Reason = '';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Flow = 'FlowName';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Node = '';
END; |
:will produce this:
Quote: |
<?xml version="1.0" encoding="UTF-8"?>
<RaiqMeldung xmlns="http://www.xxx.ch/xml/ods" xmlns:d2000="http://www.xxx.ch/xml/d2000" xmlns:raiq="http://www.xxx.ch/xml/raiq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.ch/xml/ods D:\xxx\xxx_00_03.xsd">
<raiq:RaiqHeader> </raiq:RaiqHeader>
<OdsMeldung>
<OdsHeader>
<MeldungSeqNr>0</MeldungSeqNr>
<SyncNr>0</SyncNr>
<MeldungArt>0</MeldungArt>
</OdsHeader>
<OdsBusinessDaten>
<LieferArt>I</LieferArt>
<OdsBusinessDatenDetail>
<d2000:RW_KONTO_LIST> </d2000:RW_KONTO_LIST>
</OdsBusinessDatenDetail>
</OdsBusinessDaten>
</OdsMeldung>
<raiq:RaiqError>
<raiq:Exception>ExceptionList</raiq:Exception>
<raiq:ErrorType>ErrorType</raiq:ErrorType>
<raiq:Severity>CRITICAL</raiq:Severity>
<raiq:Reason></raiq:Reason>
<raiq:Flow>FlowName</raiq:Flow>
<raiq:Node></raiq:Node>
</raiq:RaiqError>
</RaiqMeldung> |
|
|
|
Back to top |
|
 |
RAIQ |
Posted: Tue Jun 22, 2004 10:21 pm Post subject: |
|
|
Novice
Joined: 06 Feb 2003 Posts: 23 Location: Switzerland
|
thanx TonyD!
but how can i read/get the namespace-decl dynamical out of the input-message an use this to generate the output-message?
regards |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 23, 2004 3:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You might be able to do (untested!!)
Code: |
Declare abcd NAMESPACE {InputRoot.Blah.BLAH.NamespaceField} |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
TonyD |
Posted: Wed Jun 23, 2004 4:34 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
Well this:
Code: |
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
-- DECLARE refRoot REFERENCE TO InputRoot.XMLNS;
-- MOVE refRoot FIRSTCHILD;
-- DECLARE odsNS CHARACTER FIELDVALUE(refRoot.(XML.NamespaceDecl)xmlns);
-- DECLARE raiqNS CHARACTER FIELDVALUE(refRoot.(XML.NamespaceDecl)xmlns:raiq);
DECLARE ods NAMESPACE 'http://www.xxx.ch/xml/ods';
DECLARE raiqNS CHARACTER FIELDVALUE(InputRoot.XMLNS.ods:RaiqMeldung.(XML.NamespaceDecl)xmlns:raiq);
DECLARE raiq NAMESPACE raiqNS;
-- DECLARE raiq NAMESPACE 'http://www.xxx.ch/xml/raiq';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Exception = 'ExceptionList';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:ErrorType = 'ErrorType';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Severity = 'CRITICAL';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Reason = '';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Flow = 'FlowName';
SET OutputRoot.XMLNS.ods:RaiqMeldung.raiq:RaiqError.raiq:Node = '';
END;
|
:produces:
Quote: |
<?xml version="1.0" encoding="UTF-8"?>
<RaiqMeldung xmlns="http://www.xxx.ch/xml/ods" xmlns:d2000="http://www.xxx.ch/xml/d2000" xmlns:raiq="http://www.xxx.ch/xml/raiq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xxx.ch/xml/ods D:\xxx\xxx_00_03.xsd">
<raiq:RaiqHeader> </raiq:RaiqHeader>
<OdsMeldung>
<OdsHeader>
<MeldungSeqNr>0</MeldungSeqNr>
<SyncNr>0</SyncNr>
<MeldungArt>0</MeldungArt>
</OdsHeader>
<OdsBusinessDaten>
<LieferArt>I</LieferArt>
<OdsBusinessDatenDetail>
<d2000:RW_KONTO_LIST> </d2000:RW_KONTO_LIST>
</OdsBusinessDatenDetail>
</OdsBusinessDaten>
</OdsMeldung>
<raiq:RaiqError>
<raiq:Exception>ExceptionList</raiq:Exception>
<raiq:ErrorType>ErrorType</raiq:ErrorType>
<raiq:Severity>CRITICAL</raiq:Severity>
<raiq:Reason></raiq:Reason>
<raiq:Flow>FlowName</raiq:Flow>
<raiq:Node></raiq:Node>
</raiq:RaiqError>
</RaiqMeldung>
|
However it was still necessary to declare a prefix (ods) for the message's target namespace. I tried to avoid this by getting to the namespace declaration via the (commented out) reference variable refRoot + MOVE FIRSTCHILD but there seems to be some namespace-related difficulty when using MOVE to position correctly which I have not yet been able to solve. |
|
Back to top |
|
 |
|