Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Collapse XMl tags for all the XMLS in a file

    Help wanted · · · – – – · · ·
    2
    2
    2903
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User last edited by

      
      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.
      
      
      1 Reply Last reply Reply Quote -2
      • PeterJones
        PeterJones last edited by PeterJones

        @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

        1 Reply Last reply Reply Quote 3
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors