2

I have a problem with Apache Digester 3.2 I hope you can help me with:

The XML I have to parse contains the following lines (and much more):

<CountryName
    code = "GFR"
    name = "Germany"
    IsTerritory = "False"
    ProfileURL = "germany.doc"/>

The rules for the digester are given by another XML-file:

   <pattern value="CountryName">
      <object-create-rule classname="model.CodeNamePair"/>
      <set-properties-rule/>
      <set-next-rule methodname="addCountry"/>
   </pattern>

This should create an Object of CodeNamePair (which contains a String 'code' and a String 'name', just like in the XML above.
The next method 'addCountry' is (hopefully) not relevant for this problem which follows now:
The digester is not able to parse this part. It throws a NoSuchMethodException with message:

"java.lang.NoSuchMethodException: Property IsTerritory can't be set"

Although I don't want to parse the IsTerritory property. Do you know if (and how) I will be able to ignore this property?

Already now: Thank you very much (I hope my question is not written too complicated)

Cemron
  • 1,443
  • 1
  • 12
  • 15

1 Answers1

1

Try

<set-properties-rule>
  <ignore attr-name="IsTerritory" />
</set-properties-rule>

instead of

<set-properties-rule/>

(Not tested)