Collapse XMl tags for all the XMLS in a file
-
I have a list of XMls in a file. eg: <ns:topic> <ns:location>asfsafs</ns:location> <ns:locationevent>yyyy</ns:locationevent> <Period> <ns:ProcessYear>1</ns:ProcessYear> <ns:Status>Processed</ns:Status> </Period> <Period> <ns:ProcessYear>2</ns:ProcessYear> <ns:Status>Pending</ns:Status> </Period> <Period> <ns:ProcessYear>3</ns:ProcessYear> <ns:Status>UnProcessed</ns:Status> </Period> <ns:Action> <ns:name>abc</ns:name> </ns:Action> <ns:Action> <ns:name>def</ns:name> </ns:Action> <ns:Coverage> <ns:Action> <ns:name>def</ns:name> </ns:Action> </ns:Coverage> <ns:ID>12233</ns:ID> </ns:topic> <ns:topicc> <ns:location>asfsafs</ns:location> <ns:locationevent>yyyy</ns:locationevent> <Period> <ns:ProcessYear>1</ns:ProcessYear> <ns:Status>Processed</ns:Status> </Period> <Period> <ns:ProcessYear>2</ns:ProcessYear> <ns:Status>Pending</ns:Status> </Period> <Period> <ns:ProcessYear>3</ns:ProcessYear> <ns:Status>UnProcessed</ns:Status> </Period> <ns:Action> <ns:name>abc</ns:name> </ns:Action> <ns:Action> <ns:name>def</ns:name> </ns:Action> <ns:Coverage> <ns:Action> <ns:name>def</ns:name> </ns:Action> </ns:Coverage> <ns:ID>12223</ns:ID> </ns:topic> I want to collapse certain tags(eg: <period>,<ns:Action> and <ns:Coverage> and its subelements), to check, if expected Id values is present in the `<ns:ID>` subelement from the XML node. By a single command, is there any possibility to do this without going to specific places. I need a solution which should applicable to all the XMLS which are in the file.
-
@vijay-S ,
This is not your personal XML support forum.
You have been given plenty (dozens!) of regex examples to manipulate XML, and @guy038 has selflessly iterated through your ever-changing requirements to try to satisfy you.
I have previously explained to you that you need to read documentation (which I linked to), and show what you’ve tried, and basically you need to show some effort.
Notepad++ has builtin XML language syntax highlighting and code folding, and View > Collapse Level / Uncollapse Level will help you hide and unhide various levels of your XML hierarchy.
There are plugins for Notepad++ – noteably, XML Tools – which will help you with validation, syntax checking, etc.
@Peter-Brand has recommended that you use XSLT to do your XML transformations.
There are programming languages out there with libraries that will help you extract just the information you want from your XML files.
Please show some effort