how to make Eclipse ignore errors in certain .xml files?

Discussion in 'Java' started by Andreas Leitgeb, Jul 11, 2012.

  1. Some project developed in Eclipse needs certain "*.xml"-files
    for running/testing. Some of these files are (and really have
    to be) invalid XML and eclipse flags them red.

    I'd like to tell eclipse to treat certain handpicked xml-files
    as opaque files and to not even attempt to validate them any way.
    There are also *other* xml-files in the project that I still want
    to have validated and eventually red-flagged. These however are
    in different folders than the "bad" ones, in case it matters...

    I've tried googling for: eclipse xml errors ignore validate
    (and subsets thereof) but couldn't find a relevant one among
    the results, yet.
     
    Andreas Leitgeb, Jul 11, 2012
    #1
    1. Advertising

  2. Andreas Leitgeb

    Eric Sosman Guest

    On 7/11/2012 10:06 AM, Andreas Leitgeb wrote:
    > Some project developed in Eclipse needs certain "*.xml"-files
    > for running/testing. Some of these files are (and really have
    > to be) invalid XML and eclipse flags them red.
    >
    > I'd like to tell eclipse to treat certain handpicked xml-files
    > as opaque files and to not even attempt to validate them any way.
    > There are also *other* xml-files in the project that I still want
    > to have validated and eventually red-flagged. These however are
    > in different folders than the "bad" ones, in case it matters...
    >
    > I've tried googling for: eclipse xml errors ignore validate
    > (and subsets thereof) but couldn't find a relevant one among
    > the results, yet.


    Have you tried giving the bad files a different extension,
    like "foo.bad" instead of "foo.xml"?

    --
    Eric Sosman
    d
     
    Eric Sosman, Jul 11, 2012
    #2
    1. Advertising

  3. Solved (was: Re: how to make Eclipse ignore errors in certain .xmlfiles?)

    Eric Sosman <> wrote:
    > On 7/11/2012 10:06 AM, Andreas Leitgeb wrote:
    >> Some project developed in Eclipse needs certain "*.xml"-files
    >> for running/testing. Some of these files are (and really have
    >> to be) invalid XML and eclipse flags them red.
    >> I'd like to tell eclipse to treat certain handpicked xml-files
    >> as opaque files and to not even attempt to validate them any way.
    >> There are also *other* xml-files in the project that I still want
    >> to have validated and eventually red-flagged. These however are
    >> in different folders than the "bad" ones, in case it matters...
    >> I've tried googling for: eclipse xml errors ignore validate
    >> (and subsets thereof) but couldn't find a relevant one among
    >> the results, yet.

    > Have you tried giving the bad files a different extension,
    > like "foo.bad" instead of "foo.xml"?


    Thanks for the response!
    No I haven't. I actually thought of it, but it wasn't an option...
    (it would have implied some complication on the build process, that
    the coworkers wouldn't have agreed on - they preferred to just
    ignore those red flags)

    I really just came back to post that I did find a solution
    myself. (well, it was behind one of those google-hits, that I
    had previously discarded as irrelevant by the abstract :-} )


    For the record: In the Window->Preferences dialog, I pick Validation,
    and in the line "XML Validator" I click the triple-dot-button. In the
    Window that pops up, I then click on "Exclude Group", then button "Add
    Rule".

    I then selected the folder that contained those purposefully bad
    xml-files, but I could just as well have selected each file indi-
    vidually, or (probably) specified a pattern like "testcase-42.*.xml"
    for the files to ignore.

    It didn't immediately show any effect, though (even after "OK"ing
    all the dialogs up to and including "Preferences"). I then right-
    clicked on the folder in the "Project Explorer" pane of eclipse,
    and from the context menu I picked Validate. Only then, the red
    flags disappeared.

    Nice thing is that (unlike renaming the files) these preferences
    only affect me, so the coworkers still see the red flags on those
    xml-files in their eclipse...
     
    Andreas Leitgeb, Jul 11, 2012
    #3
  4. Andreas Leitgeb

    EricF Guest

    In article <>, wrote:
    >Some project developed in Eclipse needs certain "*.xml"-files
    >for running/testing. Some of these files are (and really have
    >to be) invalid XML and eclipse flags them red.
    >
    >I'd like to tell eclipse to treat certain handpicked xml-files
    >as opaque files and to not even attempt to validate them any way.
    >There are also *other* xml-files in the project that I still want
    >to have validated and eventually red-flagged. These however are
    >in different folders than the "bad" ones, in case it matters...
    >
    >I've tried googling for: eclipse xml errors ignore validate
    >(and subsets thereof) but couldn't find a relevant one among
    >the results, yet.
    >

    I see that you figured out how to get past this but it has a bad smell to it.
    If the files are bad xml and have to be bad xml, then they should not be
    xml.Or the bad part should be cdata. Someone doesn't know what they are doing.

    Eric
     
    EricF, Jul 12, 2012
    #4
  5. EricF <> wrote:
    > In article <>, wrote:
    >> Some project developed in Eclipse needs certain "*.xml"-files
    >> for running/testing. Some of these files are (and really have
    >> to be) invalid XML and eclipse flags them red.

    > I see that you figured out how to get past this but it has a bad smell to it.


    I do agree on the bad smell, but natural fertilizer typically has it, too... ;-)

    > If the files are bad xml and have to be bad xml, then they should not be xml.


    The tool, to which these files are fed, woudn't accept anything but files
    with an .xml extension. That means, we would have to rename the files to
    ..xml during production. Specifically silencing eclipse for them really looks
    like the easier (less intrusive) solution. What I didn't write so far is,
    that the maintenance of the valid and the invalid xmls is some coworker's job
    and he probably appreciates seeing the red flags where he actively expects
    to see them. It's an indication to them that the right part is wrong ;-)

    > Or the bad part should be cdata.


    Making the bad part cdata, however, misses the point, as the files would be
    correct xml, then.

    Thanks, anyway, for caring that far. I don't ask anyone to waste more
    thoughts into this thread. There are too many unanswered questions (two
    old ones by myself, one about sharing code between a library-project and
    a plugin-project in eclipse <>,
    and one about Corba and ssliop <>)
    whose answering would be so much more appreciated...
     
    Andreas Leitgeb, Jul 12, 2012
    #5
  6. Andreas Leitgeb

    Jason Bailey Guest

    On 7/12/2012 4:00 AM, Andreas Leitgeb wrote:
    > EricF<> wrote:
    >> In article<>, wrote:
    >>> Some project developed in Eclipse needs certain "*.xml"-files
    >>> for running/testing. Some of these files are (and really have
    >>> to be) invalid XML and eclipse flags them red.

    >> I see that you figured out how to get past this but it has a bad smell to it.

    >

    <snip>
    > Thanks, anyway, for caring that far. I don't ask anyone to waste more
    > thoughts into this thread. There are too many unanswered questions (two
    > old ones by myself, one about sharing code between a library-project and
    > a plugin-project in eclipse<>,
    > and one about Corba and ssliop<>)
    > whose answering would be so much more appreciated...
    >


    Another thought, would it be acceptable to change the error message to a
    warning? This is done through the configuration properties > Validation
    > XML


    -jason
     
    Jason Bailey, Jul 12, 2012
    #6
  7. Jason Bailey <> wrote:
    > On 7/12/2012 4:00 AM, Andreas Leitgeb wrote:
    >> EricF<> wrote:
    >>> In article<>, wrote:
    >>>> Some project developed in Eclipse needs certain "*.xml"-files
    >>>> for running/testing. Some of these files are (and really have
    >>>> to be) invalid XML and eclipse flags them red.
    >>> I see that you figured out how to get past this but it has a bad smell to it.

    ><snip>
    >> Thanks, anyway, for caring that far. I don't ask anyone to waste more
    >> thoughts into this thread. There are too many unanswered questions (two
    >> old ones by myself, one about sharing code between a library-project and
    >> a plugin-project in eclipse<>,
    >> and one about Corba and ssliop<>)
    >> whose answering would be so much more appreciated...

    > Another thought, would it be acceptable to change the error message to a
    > warning? This is done through the configuration properties > Validation
    > > XML


    I vaguely remember having tried to configure all XML-Validation errors
    to warnings already before posting here.

    I just retried it: removed the exclude-rule, validated manually (red
    flags re-appeared, as expected), set all the "Errors/Warnings"-items
    to "warning", validated manually (red flags still there, as not wanted).

    Then I re-instated the exclude rule for the folder, validated manually
    and the red flags are once again gone.
     
    Andreas Leitgeb, Jul 13, 2012
    #7
  8. Andreas Leitgeb

    Roedy Green Guest

    On Wed, 11 Jul 2012 14:06:52 +0000 (UTC), Andreas Leitgeb
    <> wrote, quoted or indirectly quoted
    someone who said :

    >Some project developed in Eclipse needs certain "*.xml"-files
    >for running/testing. Some of these files are (and really have
    >to be) invalid XML and eclipse flags them red.


    Would changing the extension be an option?
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    The greatest shortcoming of the human race is our inability to understand the exponential function.
    ~ Dr. Albert A. Bartlett (born: 1923-03-21 age: 89)
    http://www.youtube.com/watch?v=F-QA2rkpBSY
     
    Roedy Green, Jul 13, 2012
    #8
  9. Roedy Green <> wrote:
    ><> wrote, ... :
    >> Some project developed in Eclipse needs certain "*.xml"-files
    >> for running/testing. Some of these files are (and really have
    >> to be) invalid XML and eclipse flags them red.

    > Would changing the extension be an option?


    Short answer: no, wouldn't. This suggestion and a (slghtly)
    longer answer already appeared on this thread.

    Btw., as you apparently see my posts, I wonder if you
    also saw my followup on your request for translation of
    that german poem by guenther grass.
     
    Andreas Leitgeb, Jul 13, 2012
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    677
  2. Joe Stateson

    possible to ignore xml errors?

    Joe Stateson, Oct 26, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    580
    bruce barker
    Oct 26, 2007
  3. Replies:
    2
    Views:
    554
    bruce barker
    Mar 25, 2008
  4. Rob Meade
    Replies:
    6
    Views:
    299
    Rob Meade
    Mar 1, 2004
  5. David Karr

    How to make XML::XPath ignore namespaces?

    David Karr, May 21, 2013, in forum: Perl Misc
    Replies:
    0
    Views:
    184
    David Karr
    May 21, 2013
Loading...

Share This Page