Author |
Message
|
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 11:05 am Post subject: Accessing InputRoot from a SHARED ROW. |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
I am reading a config.xml in a FileRead node and am saving the parsed XML into a SHARED ROW in a Compute node.
Code: |
Declare instanceDocument Shared Row;
Set instanceDocument = InputRoot.XMLNSC;
|
The SHARED ROW declaration is under BROKER SCHEMA statement so that this variable is flow-wide.
Then, in another Compute node, I am 'de-referencing' the SHARED ROW as
Code: |
Declare genericDoc Reference to instanceDocument ;
Declare rootElement Char FieldName(genericDoc.*[1]);
Declare rs Namespace FieldNameSpace(genericDoc.*[1]);
Declare rootChild1 Char FieldName(genericDoc.{rootElement}.*[2]);
|
The user trace for rootElement says,
Quote: |
Failed to navigate to path element number '2' because it does not exist. |
What obvious piece of documentation have I missed due to which I am unable to de-reference the SHARED ROW ? _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
Esa |
Posted: Sun May 12, 2013 12:05 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
I don't know if it is the cause of your problem, but putting a parser in a shared row variable does not sound like a good idea.
It seems you are trying to skip over the XML declaration. Are you sure that your config.xml file has one?
You could try something like this:
Code: |
DECLARE ref REFERENCE TO InputRoot.XMLNSC;
MOVE ref LASTCHILD;
CREATE LASTCHILD OF instanceDocument FROM ref; |
|
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 6:57 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
Esa wrote: |
I don't know if it is the cause of your problem, but putting a parser in a shared row variable does not sound like a good idea. |
For ROW data-type, the documentation says -
Quote: |
InputRoot, OutputRoot, and so on, are examples of ROW variables that are automatically declared and present in the data structure, ready for use. |
Since I want only the sub-tree under XMLNSC, I assigned InputRoot.XMLNSC to instanceDocument. Isn't that correct ?
Esa wrote: |
It seems you are trying to skip over the XML declaration. Are you sure that your config.xml file has one? |
No, XML declaration is not and will not be present.
I tried your suggestion. In another Compute node, where the SHARED ROW is to be de-referenced, I have this to check what I have got.
Code: |
Create lastChild of OutputRoot from instanceDocument ;
Propagate to terminal 'out1';
Return true ;
|
And, in the Trace node, wired to Out1, I have,
Code: |
user@host:~$ more logs/TRC01.log
( ['GENERICROOT' : 0x7f81440c4920]
(0x01000000:Name):Properties = ( ['MQPROPERTYPARSER' : 0x7f81442622b0]
(0x03000000:NameValue):MessageSet = NULL
(0x03000000:NameValue):MessageType = NULL
(0x03000000:NameValue):MessageFormat = NULL
(0x03000000:NameValue):Encoding = NULL
(0x03000000:NameValue):CodedCharSetId = NULL
(0x03000000:NameValue):Transactional = NULL
(0x03000000:NameValue):Persistence = NULL
(0x03000000:NameValue):CreationTime = NULL
(0x03000000:NameValue):ExpirationTime = NULL
(0x03000000:NameValue):Priority = NULL
(0x03000000:NameValue):ReplyIdentifier = NULL
(0x03000000:NameValue):ReplyProtocol = 'ADAPTOR' (CHARACTER)
(0x03000000:NameValue):Topic = NULL
(0x03000000:NameValue):ContentType = NULL
(0x03000000:NameValue):IdentitySourceType = NULL
(0x03000000:NameValue):IdentitySourceToken = NULL
(0x03000000:NameValue):IdentitySourcePassword = NULL
(0x03000000:NameValue):IdentitySourceIssuedBy = NULL
(0x03000000:NameValue):IdentityMappedType = NULL
(0x03000000:NameValue):IdentityMappedToken = NULL
(0x03000000:NameValue):IdentityMappedPassword = NULL
(0x03000000:NameValue):IdentityMappedIssuedBy = NULL
)
(0x01000000:Name):Root = (
(0x03000000:NameValue)urn:namespace.generic:genericDoc = NULL
)
)
|
Why isn't the complete parsed tree not saved in SHARED ROW ? _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Sun May 12, 2013 9:37 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
What is the version of the broker you are using?
And are you referring to SHARED variable from the same or another ESQL file?
--
Marko
Last edited by marko.pitkanen on Sun May 12, 2013 9:50 pm; edited 1 time in total |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 9:44 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
8.0.0.1 on Linux 64-bit, Ubuntu-12.04. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Sun May 12, 2013 9:56 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
And are you referring to SHARED variable from the same or another ESQL file? |
|
Back to top |
|
 |
Esa |
Posted: Sun May 12, 2013 10:22 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Check your MQInput node or whatever node you are using for input. It seems you have not set the parser to XMLNSC.
Cogito-Ergo-Sum wrote: |
Esa wrote: |
I don't know if it is the cause of your problem, but putting a parser in a shared row variable does not sound like a good idea. |
For ROW data-type, the documentation says -
Quote: |
InputRoot, OutputRoot, and so on, are examples of ROW variables that are automatically declared and present in the data structure, ready for use. |
|
InputRoot, OutputRoot etc. are not SHARED.
I guess you can safely put a parser into a shared row if you are going to let it stay there and not going to switch it to another instance every now and then. People who know the product internals better may comment if a parser that is orphaned from a shared row has a lifetime that exeeds the lifetime of the current flow instance or not. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Sun May 12, 2013 10:27 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Have you verified that when you assign XMLNSC -tree from InputRoot to SHARED variable your broker actually is doing tree copy?
--
Marko |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 10:27 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
marko.pitkanen wrote: |
And are you referring to SHARED variable from the same or another ESQL file? |
Another ESQL file but same schema. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 10:31 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
marko.pitkanen wrote: |
Have you verified that when you assign XMLNSC -tree from InputRoot to SHARED variable your broker actually is doing tree copy?
--
Marko |
I haven't checked when assigning. But, in my de-referencing ESQL, I am writing instanceDocument to OutputRoot. The tree isn't copied. See above. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Sun May 12, 2013 10:34 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi,
I made a quick test with version 7.0.0.3
Code: |
'TEST.Compute': Executing statement ''DECLARE instDOC SHARED ROW;'' at ('.instDOC', '1.1').
.
.
.
'TEST.Compute': Executing statement ''SET instDOC = InputRoot.XMLNSC;'' at ('.TEST_Compute.Main', '20.9').
'TEST.Compute': Copying sub-tree from ''InputRoot.XMLNSC'' to ''instDOC''.
.
.
.
'TEST.Compute1': Executing statement ''DECLARE instDOC SHARED ROW;'' at ('.instDOC', '1.1').
'TEST.Compute1': Executing statement ''DECLARE rRef REFERENCE TO instDOC;'' at ('.TEST_Compute1.Main', '5.3').
'TEST.Compute1': Executing statement ''SET OutputRoot.XMLNSC = rRef;'' at ('.TEST_Compute1.Main', '6.3').
'TEST.Compute1': Copying sub-tree from ''rRef'' to ''OutputRoot.XMLNSC''.
|
Seems that it works there. |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 10:36 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
Esa wrote: |
Check your MQInput node or whatever node you are using for input. It seems you have not set the parser to XMLNSC. |
The parser is set to DFDL at the FileInput node. However, there is a FileRead node in the flow that reads an XML document. The result is put in the OutputRoot such that, the Compute node has access to DFDL and XMLNSC trees. I need it this way for processing the DFDL input.
Some more background.
A) Read a CSV record from FileInput node parsed by a DFDL.
B) In Filter node, look for LocalEnvironment.File.Record=1. If true, goto FileRead node. Read XML and put it in XMLNSC tree. Goto Compute node 1 and put this XML into a SHARED ROW. If false, access SHARED ROW for processing in Compute node 2. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
Esa |
Posted: Sun May 12, 2013 10:42 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Putting a trace node before compute 1 might tell you something valuable. |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Sun May 12, 2013 11:03 pm Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
As mentioned in B) in my previous post, I can see InputRoot.XMLNSC and InputRoot.DFDL.
My aim is to save the InputRoot.XMLNSC into a SHARED ROW so that for record number 2 onwards, I refer to this row instead of reading and parsing the XML document again and again from the FileRead node. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Sun May 12, 2013 11:08 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Share us debug level user trace from your test case.
--
Marko |
|
Back to top |
|
 |
|