使用DefaultHandler进行SAX解析会将所有文本转换为小写

时间:2012-07-12 07:11:32

标签: java xml parsing sax

我使用DefaultHandler来解析基于XML的InputStream。它工作正常,但有一个例外。所有字符都转换为小写。 例如,如果我的xml有像VALUE这样的元素,我在解析后看到的是值(而不是VALUE)。 有什么线索如何在解析原始案例(大写而不是小写)时获取值?

public void endElement(String uri, String name, String qName) throws SAXException {
    try {
         if(name.equalsIgnoreCase("taga")){
          System.err.println("value parsed .. "+_objBuffer.toString());

   }
   catch (Exception e) {}

}

public void characters(char[] ch, int start, int length) throws SAXException {
    try{
            _objBuffer.append(ch, start, length);
    } catch(Exception e) {}
}

1 个答案:

答案 0 :(得分:0)

尝试检查实现功能SELECT top 500 excepts.msgs_id as a_id, b.msgs_id as b_id, excepts.hipaa837insvcline_id as a_svc, b.hipaa837insvcline_id as b_svc, msgs.hipaa837insvcline_id as msgs_svc FROM hipaa837inmast INNER JOIN Hipaa837INSubmitter ON Hipaa837INSubmitter.batch_Number = hipaa837inmast.Batch_Number LEFT JOIN Provider ON Provider.prov_id = Hipaa837INSubmitter.Prov_ID INNER JOIN Hipaa837INSubscriber ON Hipaa837INSubscriber.Batch_Number = Hipaa837INSubmitter.Batch_Number INNER JOIN hipaa837inbillingpayTo ON hipaa837inbillingpayTo.hipaa837inbillingpayTo_Id = Hipaa837INSubscriber.hipaa837inbillingpayTo_Id INNER JOIN Hipaa837INPatientClaim clm ON clm.Hipaa837INSubscriber_ID = Hipaa837INSubscriber.Hipaa837INSubscriber_ID INNER JOIN Hipaa837INSVCLine svc ON svc.Hipaa837INPatientClaim_ID = clm.Hipaa837INPatientClaim_ID LEFT JOIN patient ON patient.Patient_ID = clm.Patient_ID LEFT JOIN (select DISTINCT ecpexcept.msgs_id,ecpexcept.hipaa837insvcline_id from incedo.ecpexcept INNER JOIN [incedo].[ecpreason] WITH (NOLOCK) on ecpreason.msgs_id = ecpexcept.msgs_id INNER JOIN [incedo].[hipaa837insvcline] t WITH (NOLOCK) on ecpexcept.hipaa837insvcline_id = t.hipaa837insvcline_id WHERE ecpexcept.msgs_id in (13) ) msgs ON msgs.hipaa837insvcline_id = svc.hipaa837insvcline_id --attempt to only show 0 hierarchy if no other except LEFT JOIN (select DISTINCT ecpexcept.msgs_id,ecpexcept.hipaa837insvcline_id from incedo.ecpexcept INNER JOIN (SELECT TOP 1 ecpreason.msgs_id,hierarchy,ecpreason.reason FROM [incedo].[ecpreason] WITH (NOLOCK) INNER JOIN [incedo].[ecpexcept] WITH (NOLOCK) on ecpreason.msgs_id = ecpexcept.msgs_id INNER JOIN [incedo].[hipaa837insvcline] t WITH (NOLOCK) on ecpexcept.hipaa837insvcline_id = t.hipaa837insvcline_id WHERE hierarchy > 0 ORDER BY hierarchy ) a on a.Msgs_ID in (13) AND a.msgs_id = ecpexcept.msgs_id ) excepts ON excepts.hipaa837insvcline_id = svc.hipaa837insvcline_id AND msgs.hipaa837insvcline_id IS NOT NULL LEFT JOIN (SELECT DISTINCT ecpreason.msgs_id, T.hipaa837insvcline_id FROM [incedo].[ecpreason] WITH (NOLOCK) LEFT JOIN [incedo].[ecpexcept] zero WITH (NOLOCK) on ecpreason.msgs_id = zero.msgs_id AND hierarchy = 0 LEFT JOIN [incedo].[ecpexcept] great WITH (NOLOCK) on ecpreason.msgs_id = great.msgs_id AND great.msgs_id IN (13) INNER JOIN [incedo].[hipaa837insvcline] t WITH (NOLOCK) on zero.hipaa837insvcline_id = t.hipaa837insvcline_id WHERE zero.msgs_id IS NOT NULL AND great.msgs_id IS NULL ) b on svc.hipaa837insvcline_id = b.hipaa837insvcline_id AND excepts.hipaa837insvcline_id IS NULL WHERE ((msgs.hipaa837insvcline_id IS NULL AND b.hipaa837insvcline_id IS NOT NULL AND excepts.hipaa837insvcline_id IS NULL) OR --hierarchy=0 (msgs.hipaa837insvcline_id IS NOT NULL AND b.hipaa837insvcline_id IS NULL AND excepts.hipaa837insvcline_id IS NOT NULL)) AND --hierarchy>0

可能您应该使用equalsIgnoreCase()而不是equals()