You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Ugur Seker (JIRA)" <xe...@xml.apache.org> on 2011/02/09 00:16:57 UTC
[jira] Created: (XERCESJ-1495) Xerces 2.11 "]" problem ( Right
square bracket )
Xerces 2.11 "]" problem ( Right square bracket )
------------------------------------------------
Key: XERCESJ-1495
URL: https://issues.apache.org/jira/browse/XERCESJ-1495
Project: Xerces2-J
Issue Type: Bug
Affects Versions: 2.11.0
Reporter: Ugur Seker
Fix For: 2.11.0
Hi
I see following problem after upgrading from Xerces1 to Xerces2
Xerces2 misbehaves if the value includes "]" character.
Here is an example for old (Xerces1) and new (Xerces2) behaviour the given xml chunk. ( Problem not exist for CDATA fields )
I believe same problem (logically) was reported for Xerces C++ before
(https://issues.apache.org/jira/browse/XERCESC-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs )
XML Chunk
```````````````````````
<pattern>[A-Za-z0-9/_]+</pattern>
Source Logic
`````````````````````
public void characters(char[] ch, int start, int length)
{
final String text = new String( ch, start, length );
final String text1 = text.trim();
System.out.println("MYTEXT :"+ text1.toString());
System.out.println("MYSTART :"+ start);
System.out.println("MYLENGTH :"+ length);
System.out.println("MYELEMENT :" + element.toString());
System.out.println("------------------------------");
}
Xerces1 behaviour (output from character function)
```````````````````````````````````````````
------------------------------
MYTEXT :[A-Za-z0-9/_]+
MYSTART :10320
MYLENGTH :21
MYELEMENT :pattern
------------------------------
Xerces2 behaviour - has bug (output from character function)
```````````````````````````````````````````
------------------------------
MYTEXT :[A-Za-z0-9/_
MYSTART :27
MYLENGTH :19
MYELEMENT :pattern
------------------------------
MYTEXT :]
MYSTART :0
MYLENGTH :1
MYELEMENT :pattern
------------------------------
MYTEXT :+
MYSTART :47
MYLENGTH :1
MYELEMENT :pattern
------------------------------
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Updated: (XERCESJ-1495) Xerces 2.11 "]" problem ( Right
square bracket )
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XERCESJ-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich updated XERCESJ-1495:
------------------------------------------
Fix Version/s: (was: 2.11.0)
> Xerces 2.11 "]" problem ( Right square bracket )
> ------------------------------------------------
>
> Key: XERCESJ-1495
> URL: https://issues.apache.org/jira/browse/XERCESJ-1495
> Project: Xerces2-J
> Issue Type: Bug
> Affects Versions: 2.11.0
> Reporter: Ugur Seker
>
> Hi
> I see following problem after upgrading from Xerces1 to Xerces2
> Xerces2 misbehaves if the value includes "]" character.
> Here is an example for old (Xerces1) and new (Xerces2) behaviour the given xml chunk. ( Problem not exist for CDATA fields )
> I believe same problem (logically) was reported for Xerces C++ before
> (https://issues.apache.org/jira/browse/XERCESC-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs )
> XML Chunk
> ```````````````````````
> <pattern>[A-Za-z0-9/_]+</pattern>
> Source Logic
> `````````````````````
> public void characters(char[] ch, int start, int length)
> {
> final String text = new String( ch, start, length );
> final String text1 = text.trim();
> System.out.println("MYTEXT :"+ text1.toString());
> System.out.println("MYSTART :"+ start);
> System.out.println("MYLENGTH :"+ length);
> System.out.println("MYELEMENT :" + element.toString());
> System.out.println("------------------------------");
> }
> Xerces1 behaviour (output from character function)
> ```````````````````````````````````````````
> ------------------------------
> MYTEXT :[A-Za-z0-9/_]+
> MYSTART :10320
> MYLENGTH :21
> MYELEMENT :pattern
> ------------------------------
> Xerces2 behaviour - has bug (output from character function)
> ```````````````````````````````````````````
> ------------------------------
> MYTEXT :[A-Za-z0-9/_
> MYSTART :27
> MYLENGTH :19
> MYELEMENT :pattern
> ------------------------------
> MYTEXT :]
> MYSTART :0
> MYLENGTH :1
> MYELEMENT :pattern
> ------------------------------
> MYTEXT :+
> MYSTART :47
> MYLENGTH :1
> MYELEMENT :pattern
> ------------------------------
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
[jira] Resolved: (XERCESJ-1495) Xerces 2.11 "]" problem ( Right
square bracket )
Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XERCESJ-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich resolved XERCESJ-1495.
-------------------------------------------
Resolution: Invalid
This is not a bug.
You are assuming that all character data of an element is reported in a single chunk. This is probably the most common SAX programming error.
characters() may be called multiple times (please review the SAX API Javadoc and FAQs here [1] and here [2]) for contiguous text. Your ContentHandler needs to accumulate the text returned in each call of characters() until you receive a callback that isn't characters.
Thanks.
[1] http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ContentHandler.html#characters(char[],%20int,%20int)
[2] http://xerces.apache.org/xerces2-j/faq-sax.html#faq-2
> Xerces 2.11 "]" problem ( Right square bracket )
> ------------------------------------------------
>
> Key: XERCESJ-1495
> URL: https://issues.apache.org/jira/browse/XERCESJ-1495
> Project: Xerces2-J
> Issue Type: Bug
> Affects Versions: 2.11.0
> Reporter: Ugur Seker
>
> Hi
> I see following problem after upgrading from Xerces1 to Xerces2
> Xerces2 misbehaves if the value includes "]" character.
> Here is an example for old (Xerces1) and new (Xerces2) behaviour the given xml chunk. ( Problem not exist for CDATA fields )
> I believe same problem (logically) was reported for Xerces C++ before
> (https://issues.apache.org/jira/browse/XERCESC-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs )
> XML Chunk
> ```````````````````````
> <pattern>[A-Za-z0-9/_]+</pattern>
> Source Logic
> `````````````````````
> public void characters(char[] ch, int start, int length)
> {
> final String text = new String( ch, start, length );
> final String text1 = text.trim();
> System.out.println("MYTEXT :"+ text1.toString());
> System.out.println("MYSTART :"+ start);
> System.out.println("MYLENGTH :"+ length);
> System.out.println("MYELEMENT :" + element.toString());
> System.out.println("------------------------------");
> }
> Xerces1 behaviour (output from character function)
> ```````````````````````````````````````````
> ------------------------------
> MYTEXT :[A-Za-z0-9/_]+
> MYSTART :10320
> MYLENGTH :21
> MYELEMENT :pattern
> ------------------------------
> Xerces2 behaviour - has bug (output from character function)
> ```````````````````````````````````````````
> ------------------------------
> MYTEXT :[A-Za-z0-9/_
> MYSTART :27
> MYLENGTH :19
> MYELEMENT :pattern
> ------------------------------
> MYTEXT :]
> MYSTART :0
> MYLENGTH :1
> MYELEMENT :pattern
> ------------------------------
> MYTEXT :+
> MYSTART :47
> MYLENGTH :1
> MYELEMENT :pattern
> ------------------------------
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org