doh! - that was the problem after all. I had a flag in my code that was causing it to disreguard the second callback. Please reguard previous message. Thanks for the help, august.

On 10/6/06, August Gresens <[EMAIL PROTECTED]> wrote:
Thanks for the thought Robert. I don't think this is the problem, because I'm setting the properties of a bean as I parse the document, and if the characters method was repeatedly called, the text in the bean property would be the last chunk, not the first.

Abbreviated version of code here.

String currentElementName ;
private String myPropertyElementName = "myPropertyElementName";
private String myBeanElementName = "myBeanElementName";
private myBean currentBean;


public void startElement(String uri, String name, String qName,  Attributes atts) {
           
currentElementName = qName;

if (qName.equals(myBeanElementName ) {
    currentBean = new myBean();
}

}

public void characters (char ch[], int start, int length)  {
       
String elContent = new String(ch, start, length);

if (currentElementName.equals(myBeanElementName) {
currentBean.setProperty(elContent);
}

}

Does anyone have any idea what is happening with the entity? I was under the impression that default behavior for the parser would be to handle these basic XML entieis.. Do I need an EntityResolver?

Thanks,

August


On 10/6/06, Robert Houben < [EMAIL PROTECTED]> wrote:

Not sure if this is your problem, but note that SAX will often call your character callback method multiple times, breaking up the text into blocks, and something like an entity is likely to cause a new "block" of text to be processed.  You will have to gather up all blocks of text passed to your character callback method.

 

HTH,


From: August Gresens [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 06, 2006 12:03 PM
To: [email protected]
Subject: input truncated when standard entity encountered

 

Hello

I'm using Xerces 2 to do some basic Sax parsing. I'm having a problem which I cannot seem to find any documentation on..

I'm parsing a document with basic (standard XML) entities, yet the strings returned by the parser in the characters callback method are truncated when the parser encounteres an entity.

For example, in the source document I have the following text:

<style face="normal" font="default" size="100%">Comparisons between patients&apos; and nurses&apos; assessment of pain and medication efficacy in severe burn injuries.</style>

shows up in the characters method as:

Comparisons between patients

This is probably something simple - I didn't think I needed anything like an EntityResolver for standard XML entities like this, do? Also, the skippedEntity method is not called either, so I think something strange is going on.

Thanks,

August

--
------------------------------

---------------------------
--------------------------------------------------------

August Gresens
Technical Director
Black Hammer Productions, NYC
[EMAIL PROTECTED]

---------------------------------------------------------
--------------------------------------------------------




--
---------------------------------------------------------

--------------------------------------------------------

August Gresens
Technical Director
Black Hammer Productions, NYC
[EMAIL PROTECTED]

---------------------------------------------------------
--------------------------------------------------------



--
---------------------------------------------------------
--------------------------------------------------------

August Gresens
Technical Director
Black Hammer Productions, NYC
[EMAIL PROTECTED]

---------------------------------------------------------
--------------------------------------------------------

Reply via email to