Hello Everyone,
I'm new to this forum, and I'm looking to get some help with regular expressions. I'm trying to build a regular expression that has the capability to select only the XML nodes that contain content. I'm able to get it working with XML that contains new lines, but I can't seem to get it to work if it's streamed XML, all on the same line.
This regular expression will select only the Nodes/Values that have data (Node1, Node2, Node5, Node6)
(.+)>(?![<\/]).+
<Data>
<Node1>Value1</Node1>
<Node2>Value2</Node2>
<Node3></Node3>
<Node4></Node4>
<Node5>Value3</Node5>
<Node6>Value4</Node6>
</Data>
If the values are streamed like shown below, is there a way I can achieve the same results? I'd also like to contain the parent node "Data" as well if possible.
<Data><Node1>Value1</Node1><Node2>Value2</Node2><Node3></Node3><Node4></Node4><Node5>Value3</Node5<Node6>Value4</Node6></Data>
I'm new to this forum, and I'm looking to get some help with regular expressions. I'm trying to build a regular expression that has the capability to select only the XML nodes that contain content. I'm able to get it working with XML that contains new lines, but I can't seem to get it to work if it's streamed XML, all on the same line.
This regular expression will select only the Nodes/Values that have data (Node1, Node2, Node5, Node6)
(.+)>(?![<\/]).+
<Data>
<Node1>Value1</Node1>
<Node2>Value2</Node2>
<Node3></Node3>
<Node4></Node4>
<Node5>Value3</Node5>
<Node6>Value4</Node6>
</Data>
If the values are streamed like shown below, is there a way I can achieve the same results? I'd also like to contain the parent node "Data" as well if possible.
<Data><Node1>Value1</Node1><Node2>Value2</Node2><Node3></Node3><Node4></Node4><Node5>Value3</Node5<Node6>Value4</Node6></Data>