No announcement yet.

Ignore XML Sections?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignore XML Sections?

    I'm new to using BC3 but have used BC2 for simple stuff for a few years. I need to compare two XML files but exclude a tagged section of each file from the comparison. Is there an easy way to do this?


  • #2
    Hi Jim,

    Here's a link that describes how to ignore text in BC3:
    Chris K Scooter Software


    • #3
      How can I ignore a node in an xml file?

      I want to ignore the 2nd node listed here (the "Portlet sdk" node) from about 300 different xml files ...

      <value n="id" v="BI libs"/>
      <value n="isJDK" v="false"/>

      <value n="id" v="Portlet sdk"/>
      <value n="isJDK" v="false"/>

      All 300 files have the above type entries in them.

      I've read the link that was posted previously and I assumed (perhaps incorrectly) that in order to ignore the "Portlet sdk" node (which includes the <hash> and </hash>) from my XML files I should use the "Lines" technique from the URL

      If that assumption was incorrect then what technique would your recommend using?

      If the assumption was correct then how do I go about doing this? I am currently stuck with being able to identify the string " <value n="id" v="Portlet sdk"/>" and select the next 2 lines (which gets everything from <value n="id" v="Portlet sdk"/> up to the </hash>. Unfortunately I end up leaving behind the first <hash>.

      How do I ignore the entire node? Do I have to solve this by doing regular expressions?

      Just a thought, but has anyone asked for an enhancement where a user can define a block of code to be ignored by entering the "block" of code to ignore into a multi-line text field? It's easier for me since I'm not one of those regular expression type people. I can figure out regular expression but the multi-line text field would save me a lot of time.




      • #4

        For the purposes of your comparison, are the opening and close <hash> and </hash> lines important? If not, you could mark them as unimportant in all cases and only compare the contents inside. If you expect them to always match, this shouldn't be an issue, since if <hash> aligned with a <nothash>, the <nothash> would still be important. You could define two basic grammars as:
        and label both grammars as "Hash XML Node". Then mark "Hash XML Node" as unimportant in the Session Settings. Your other grammar for the Line could then be 1 line instead of two.

        The issue is that the first <hash> is on its own line, so it would need its own definition but there are no distinguishing features to separate it from other <hash> nodes. Unfortunately, we do not support back references to define Portlet SDK, and then ignore the line preceding it.

        We do have a wishlist item to ignore code blocks. I've added your notes to it.
        Aaron P Scooter Software