Adding a "missing end-tag" check to XmlParser

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Adding a "missing end-tag" check to XmlParser

Re: Adding a "missing end-tag" check to XmlParser

Post by Guest » Thu Apr 23, 2015 11:10 am

<?xml version='1.0' encoding='UTF-8' ?>
<CLAIM_BATCH xmlns='http://legalaid.gov.uk/CCMS/ClaimManagement/Claim/1.0/XXCCMSClaimUploadABO'>
<BATCH_NAME>201504221600</BATCH_NAME>
<REJECTION_METHOD>BATCH</REJECTION_METHOD>
<CMS_APPLICATION_VERSION>CCMS Excel Test Template v1.5</CMS_APPLICATION_VERSION>
<CLAIM_LIST>
<CLAIM_LINE>



<CLAIM>
<CASE_REF>300000035008</CASE_REF>
<PROV_CLAIM_REF>300000035008-557508-201504221600</PROV_CLAIM_REF>
<LAA_ACCOUNT_NUMBER>0N149F</LAA_ACCOUNT_NUMBER>
<CLAIM_TYPE>Solicitor Final</CLAIM_TYPE>
<CLAIM_CONTACT/>
<CLAIM_ATTRIBUTES>
<CLAIM_ATTR>
<ATTR_NAME>GB_PREV_BILL_REF_SOL_APPEALS</ATTR_NAME>
<ATTR_VALUE>Final Bill 22.04.15 203.34</ATTR_VALUE>
</CLAIM_ATTR>

<CLAIM_ATTR>
<ATTR_NAME>BILL_SENT_FOR_APPROVAL</ATTR_NAME>
<ATTR_VALUE>False</ATTR_VALUE>
</CLAIM_ATTR>

<CLAIM_ATTR>
<ATTR_NAME>GB_CLAIM_ASSESSED_BY_COURT</ATTR_NAME>
<ATTR_VALUE>False</ATTR_VALUE>
</CLAIM_ATTR>


<CLAIM_ATTR>
<ATTR_NAME>GB_WOULD_BILL_DISBURSE</ATTR_NAME>
<ATTR_VALUE>True</ATTR_VALUE>
</CLAIM_ATTR>

<CLAIM_ATTR>
<ATTR_NAME>GB_WOULD_BILL_CODIFIED</ATTR_NAME>
<ATTR_VALUE>false</ATTR_VALUE>
</CLAIM_ATTR>


<CLAIM_ATTR>
<ATTR_NAME>GB_BILL_COVERS_WORK_L_H_COURTS</ATTR_NAME>
<ATTR_VALUE>false</ATTR_VALUE>
</CLAIM_ATTR>


<CLAIM_ATTR>
<ATTR_NAME>GB_MANUAL_COURT_TYPE</ATTR_NAME>
<ATTR_VALUE>County court</ATTR_VALUE>
</CLAIM_ATTR>

</CLAIM_ATTRIBUTES>


<CLAIM_LINES>
<CLAIM_LINE>
<PROV_LINE_REF>Line-1</PROV_LINE_REF>

<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140915</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Attendance upon client</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>

<PROV_LINE_REF>Line-2</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140915</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting notice(s)</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:12</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-3</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140915</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting notice(s)</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:12</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>

<PROV_LINE_REF>Line-4</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140918</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting pleadings</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:30</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-5</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140918</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting statement</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-6</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140919</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Attendance upon client</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-7</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>





<PROV_LINE_REF>Line-8</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Advocacy - Interlocutory Hearing</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:15</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-9</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Attendance upon court</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:25</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>






<PROV_LINE_REF>Line-10</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Travel to court</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>02:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-11</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting attendance note</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:12</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-12</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140922</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:18</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-13</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141111</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting pleadings</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:06</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-14</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141203</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:06</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-15</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141209</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>





<PROV_LINE_REF>Line-16</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141210</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:06</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-17</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141210</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>01:42</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>




<PROV_LINE_REF>Line-18</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20141210</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:06</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-19</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140402</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - other</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:06</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>


<PROV_LINE_REF>Line-20</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140704</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting bill/claim form</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:30</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-21</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_DATE</ATTR_NAME>
<ATTR_VALUE>20140704</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Preparation - drafting bill/claim form</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_TIME</ATTR_NAME>
<ATTR_VALUE>00:12</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_ITEM</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_UPLIFT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_VAT</ATTR_NAME>
<ATTR_VALUE>20</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>NFAM_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>



<PROV_LINE_REF>Line-22</PROV_LINE_REF>
<FEE_SCHEME>Housing</FEE_SCHEME>
<CLAIM_LINE_ATTRIBUTES>


<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_DATE</ATTR_NAME>
<ATTR_VALUE>20140912</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_ACTIVITY</ATTR_NAME>
<ATTR_VALUE>Non Expert - Court Fee</ATTR_VALUE>
</CLAIM_LINE_ATTR>


<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_CATEGORY_OF_WORK</ATTR_NAME>
<ATTR_VALUE>Non Family Hourly Rates</ATTR_VALUE>
</CLAIM_LINE_ATTR>




<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_NET_VALUE</ATTR_NAME>
<ATTR_VALUE>50.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>



<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_VAT</ATTR_NAME>
<ATTR_VALUE>0</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_FEE_EARNER</ATTR_NAME>
<ATTR_VALUE>EROL IZZET</ATTR_VALUE>
</CLAIM_LINE_ATTR>


<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_NET_PREP_COST</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_PREP_HOURLY_RATE</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_NET_COURT_COSTS</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_COURT_WORK_H_RATE</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>

<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_NET_TRAVEL_COSTS</ATTR_NAME>
<ATTR_VALUE>0.00</ATTR_VALUE>
</CLAIM_LINE_ATTR>



<CLAIM_LINE_ATTR>
<ATTR_NAME>DISB_DESCR_OTHER_COSTS</ATTR_NAME>
<ATTR_VALUE></ATTR_VALUE>
</CLAIM_LINE_ATTR>

</CLAIM_LINE_ATTRIBUTES>


</CLAIM_LINE>




</CLAIM_LINE_ATTR>
</CLAIM_LINE_ATTRIBUTES>
</CLAIM_LINE>
</CLAIM_LIST>


</CLAIM_BATCH>

Adding a "missing end-tag" check to XmlParser

Post by Tom K. » Tue Jun 19, 2012 12:35 am

I've created another variation on the RSTA XmlParser that tries
to report missing end-tags, with error line numbers closer to
the lines in question. E.g., this XML file:

xml code:

<outerTag>
<foo>
<bar> this is bar 1 </bar>
<!-- </foo>-->
<foo>
<bar> this is bar 2 </bar>
</foo>
<foo>
<bar> this is bar 3 </bar>
</foo>
</outerTag>


generates these three errors, instead of just the last one:

Error Line 5: Missing end-tag for previous element type "foo".
Error Line 8: Missing end-tag for previous element type "foo".
Error Line 11: The element type "foo" must be terminated by the matching end-tag "</foo>".

The code assumes that you are not allowed to nest tags of the same
type. I don't know if this is too specialized a feature to consider merging
it as an option into the XmlParser base code, but I thought I'd share it.

Tom K.

java code:

/**
* 08/16/2008
*
* XMLParser.java - Simple XML parser.
*
* This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details.
*/
package org.fife.ui.rsyntaxtextarea.parser;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

import org.fife.io.DocumentReader;
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
import org.fife.ui.rsyntaxtextarea.parser.*;

/**
* A parser for XML documents. Adds squiggle underlines for any XML errors
* found (though most XML parsers don't really have error recovery and so only
* can find one error at a time).<p>
*
* This class isn't actually used by RSyntaxTextArea anywhere, but you can
* install and use it yourself. Doing so is as simple as:
*
* <pre>
* XmlParser xmlParser = new XmlParser();
* textArea.addParser(xmlParser);
* </pre>
*
* To support DTD validation, specify an entity resolver when creating the
* parser, and enable validation like so:
*
* <pre>
* XmlParser xmlParser = new XmlParser(new MyEntityResolver());
* xmlParser.setValidating(true);
* textArea.addParser(xmlParser);
* </pre>
*
* Also note that a single instance of this class can be installed on
* multiple instances of <code>RSyntaxTextArea</code>.<p>
*
* For a more complete XML parsing solution, see the
* <a href="http://svn.fifesoft.com/viewvc-1.0.5/bin/cgi/viewvc.cgi/RSTALanguageSupport/trunk/?root=RSyntaxTextArea">RSTALanguageSupport
* project</a>'s <code>XmlLanguageSupport</code> class.
*
* @author Robert Futrell
* @version 1.1
*/
public class EditXmlParser extends AbstractParser {

private SAXParserFactory spf;
private DefaultParseResult result;
private EntityResolver entityResolver;


public EditXmlParser() {
this(null);
}


/**
* Constructor allowing DTD validation of documents.
*
* @param resolver An entity resolver to use if validation is enabled.
* @see #setValidating(boolean)
*/
public EditXmlParser(EntityResolver resolver) {
this.entityResolver = resolver;
result = new DefaultParseResult(this);
try {
spf = SAXParserFactory.newInstance();
} catch (FactoryConfigurationError fce) {
fce.printStackTrace();
}
}


/**
* Returns whether this parser does DTD validation.
*
* @return Whether this parser does DTD validation.
* @see #setValidating(boolean)
*/
public boolean isValidating() {
return spf.isValidating();
}


/**
* {@inheritDoc}
*/
public ParseResult parse(RSyntaxDocument doc, String style) {

result.clearNotices();
Element root = doc.getDefaultRootElement();
result.setParsedLines(0, root.getElementCount()-1);

if (spf==null || doc.getLength()==0) {
return result;
}

try {
SAXParser sp = spf.newSAXParser();
Handler handler = new MissingEndTagHandler(doc); //Handler(doc);
DocumentReader r = new DocumentReader(doc);
InputSource input = new InputSource(r);
sp.parse(input, handler);
r.close();
} catch (SAXParseException spe) {
// A fatal parse error - ignore; a ParserNotice was already created.
} catch (Exception e) {
//e.printStackTrace(); // Will print if DTD specified and can't be found
result.addNotice(new DefaultParserNotice(this,
"Error parsing XML: " + e.getMessage(), 0, -1, -1));
}

return result;

}


/**
* Sets whether this parser will use DTD validation if required.
*
* @param validating Whether DTD validation should be enabled. If this is
* <code>true</code>, documents must specify a DOCTYPE, and you
* should have used the constructor specifying an entity resolver.
* @see #isValidating()
*/
public void setValidating(boolean validating) {
spf.setValidating(validating);
}

/*
public static void main(String[] args) {
javax.swing.JFrame frame = new javax.swing.JFrame();
org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea = new
org.fife.ui.rsyntaxtextarea.RSyntaxTextArea(25, 40);
textArea.setSyntaxEditingStyle("text/xml");
XmlParser parser = new XmlParser(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if ("http://fifesoft.com/rsyntaxtextarea/theme.dtd".equals(systemId)) {
return new org.xml.sax.InputSource(getClass().getResourceAsStream("/theme.dtd"));
}
return null;
}
});
parser.setValidating(true);
textArea.addParser(parser);
try {
textArea.read(new java.io.BufferedReader(new java.io.FileReader("C:/temp/test.xml")), null);
} catch (Exception e) {
e.printStackTrace();
}
frame.setContentPane(new org.fife.ui.rtextarea.RTextScrollPane(textArea));
frame.pack();
frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
*/

/**
* Callback notified when errors are found in the XML document. Adds a
* notice to be squiggle-underlined.
*/
private class Handler extends DefaultHandler {

private Document doc;

private Handler(Document doc) {
this.doc = doc;
}

protected void doError(SAXParseException e, int level) {
int line = e.getLineNumber() - 1;
Element root = doc.getDefaultRootElement();
Element elem = root.getElement(line);
int offs = elem.getStartOffset();
int len = elem.getEndOffset() - offs;
if (line==root.getElementCount()-1) {
len++;
}
DefaultParserNotice pn = new DefaultParserNotice(EditXmlParser.this,
e.getMessage(), line, offs, len);
pn.setLevel(level);
result.addNotice(pn);
}

public void error(SAXParseException e) {
doError(e, ParserNotice.ERROR);
}

public void fatalError(SAXParseException e) {
doError(e, ParserNotice.ERROR);
}

// NOTE: If you compile with Java 5+, you must add IOException to the
// throws clause of this method. The "official" release is built with
// Java 1.4.
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
if (entityResolver!=null) {
try {
return entityResolver.resolveEntity(publicId, systemId);
} catch (IOException ioe) {
// TODO: Remove when removing 1.4.2-compatibility, as
// IOExceptions are thrown then
ioe.printStackTrace();
}
}
return super.resolveEntity(publicId, systemId);
}

public void warning(SAXParseException e) {
doError(e, ParserNotice.WARNING);
}

}


/**
* Find missing end-tags, by keeping track of
* begin-tag/end-tag pairs and creating an
* error when there is a mismatch.
*
* This assumes that tags of the same type
* cannot be nested.
*/
private class MissingEndTagHandler extends Handler {

private Locator locator;

// Keep a counter for elements (tags) encountered.
class MutableInt {
int value = 1;
public void increment() {
++value;
}
public void decrement() {
--value;
}
public int get() {
return value;
}
}
private Map<String, MutableInt> tagMap = new HashMap<String, MutableInt>();

public MissingEndTagHandler(Document doc) {
super(doc);
}

public void setDocumentLocator(Locator locator) {
this.locator = locator;
}

@Override
public void startElement(String uri, String name, String element, Attributes atri)throws SAXException{

// Count how many times in a row this element appears
MutableInt count = tagMap.get(element);
if (count == null) {
tagMap.put(element, new MutableInt());
count = tagMap.get(element);
}
else {
count.increment();
}

if (count.get() > 1) {
String message = "Missing end-tag for previous element type \""
+ element + "\".";
SAXParseException spe = new SAXParseException(message, locator);
doError(spe, ParserNotice.ERROR);
}
}

@Override
public void endElement(String uri, String name, String element)
throws SAXException {

MutableInt count = tagMap.get(element);
if (count != null) {
count.decrement();

// Note: in practice the count is never null, since
// the parser generates an earlier error when
// the begin-tag is missing.
}

}

}



}

Top

cron