|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
DTD in an XML file |
« View previous topic :: View next topic » |
Author |
Message
|
bpugh |
Posted: Fri Nov 18, 2005 10:18 am Post subject: DTD in an XML file |
|
|
Novice
Joined: 27 Apr 2004 Posts: 24 Location: St. Louis, MO
|
I have a new message flow that is receiving an XML file that contains the DTD built into it. When I manually remove the DTD, everything works fine. If I leave it in there, I get nothing. I have trace nodes connected to every possible terminal and yet I get no output when I leave the DTD in the file. The XML looks like
<?xml version="1.0"?>
<!DOCTYPE testfile [
<!ELEMENT testfile (error, (fld1 | fld4 | fld5)*)>
<!ELEMENT error (#PCDATA)>
<!ELEMENT fld1 (fld2, fld3?)>
<!ELEMENT fld2 (#PCDATA)>
<!ELEMENT fld3 (#PCDATA)>
<!ELEMENT fld4 (#PCDATA)>
<!ELEMENT fld5 (#PCDATA)>
<!ELEMENT fld6 (#PCDATA)>]>
<testfile>
<error>0</error>
<fld1>
<fld2>abc</fld2>
<fld3>xyz</fld3>
</fld1>
<fld6>def</fld6>
</testfile>
My message flow is pretty simple. It looks like
MQInput ---> Compute -----> MQOutput
with trace nodes coming off of every failure & catch terminal. As I said, I get nothing when I put a message through that contains the DTD.
My ESQL looks like this. Basically, what happens is "NbrOfRecs" always resolves to zero when the DTD is included, so it never gets into the loop. If I leave the DTD out, "NbrOfRecs" resolves to the right number and it works fine.
CREATE COMPUTE MODULE TestMsgFlow_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE NbrOfRecs INTEGER CARDINALITY(InputBody.testfile.fld1[]);
DECLARE X INTEGER;
CALL CopyMessageHeaders();
SET X = 0;
WHILE X < NbrOfRecs DO
SET X = X + 1;
. . Reformats the message from XML to COBOL & propagates to outq
END WHILE;
RETURN FALSE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
END MODULE;
Any help would be appreciated!
Bob |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 18, 2005 10:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
First, don't put trace nodes on failure terminals. Leave them unconnected.
Second, look at the broker log for errors after you run another message through - if failure terminals are connected, you won't get errors.
Third, enable broker user tracing and see what that says. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Fri Nov 18, 2005 11:02 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
When you include a DOCTYPE declaration in your input message, you must specify that the XML element you're attempting to parse is not part of the declaration. You do this like so:
Code: |
DECLARE NbrOfRecs INTEGER CARDINALITY(InputBody.(XML.Element)testfile.fld1[]); |
|
|
Back to top |
|
 |
bpugh |
Posted: Fri Nov 18, 2005 11:11 am Post subject: |
|
|
Novice
Joined: 27 Apr 2004 Posts: 24 Location: St. Louis, MO
|
That did the trick! Thanks Jeff & JT for your help. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|