You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to read a large YAML file which contains the following structure:
CASE: ## should be "- CASE"
ACCESSION:
...
TXD_CASE:
NICKNAME: ## next level/block of data but not a sequence (indent lost with formatting)
...
SCRIPT_STRUCTS:
- SCRIPT_STRUCT:
RX:
SUBSCRIPT_STRUCTS:
- SUBSCRO{T_STRUCT:
RY:
....
My issue is that using the representational model, I can get a list of the first level nodes under CASE but I don't know how to get to the the nodes underneath TXD_CASE: which is not followed with a sequence but if it were, then I wouldn't have a problem.
I believe that it must know about the substructure as it picks up other first level nodes listed after that TXD_CASE block.
I tried treating it as a sequence node but it complained that it couldn't cast the node into a Sequence node.
YamlSequenceNode txdItems = (YamlSequenceNode)mapping.Children[new YamlScalarNode("TXD_CASE")];
I am sure it must be trivial but I have not uncovered the trick!
Thanks, in advance, for your help.
The text was updated successfully, but these errors were encountered:
dlmcshan
changed the title
Using representational model, how to I get to the next level of the tree?
Using representational model, how do I get to the next level of the tree?
Feb 9, 2021
So, while I am pretty sure (but haven't consulted the YAML specifications) the YAML syntax is legit, I have a work around which is to modify the node following the TXD_CASE: (in my example) with "- NICKNAME" turning the TXD_CASE into a sequence node (even if it will be a sequence of one). I have about 50,000 such files so I will write a program to apply this fix to those files, assuming an immediate fix is not forthcoming.
I am trying to read a large YAML file which contains the following structure:
ACCESSION:
...
TXD_CASE:
NICKNAME: ## next level/block of data but not a sequence (indent lost with formatting)
...
SCRIPT_STRUCTS:
- SCRIPT_STRUCT:
RX:
SUBSCRIPT_STRUCTS:
- SUBSCRO{T_STRUCT:
RY:
....
My issue is that using the representational model, I can get a list of the first level nodes under CASE but I don't know how to get to the the nodes underneath TXD_CASE: which is not followed with a sequence but if it were, then I wouldn't have a problem.
I believe that it must know about the substructure as it picks up other first level nodes listed after that TXD_CASE block.
I tried treating it as a sequence node but it complained that it couldn't cast the node into a Sequence node.
YamlSequenceNode txdItems = (YamlSequenceNode)mapping.Children[new YamlScalarNode("TXD_CASE")];
I am sure it must be trivial but I have not uncovered the trick!
Thanks, in advance, for your help.
The text was updated successfully, but these errors were encountered: