SAXparseException from Clipboard text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rich Sweeny

    #1

    SAXparseException from Clipboard text

    Hi,

    I have a program that is being used on Mac's and PC's. The Mac's are running
    OSX. The user can copy and paste text from the clipboard into a JTextArea
    which is part of a form. Sometimes when the text comes from the clipboard
    there is a hollow box at the end. This box cannot be selected. I am using
    the DecodeXML and EncodeXML methods to save files to disk until the user
    decides to save the files to a database. When these files are written or
    read from disk I receive this error:

    'org.xml.sax.SA XParseException : Illegal XML character: �.'

    Does anyone have a clue as to what � translates to? What is this that is
    coming from the clipboard. This is text that is being copied from one
    application to a java textfield all on a Mac. This is not persistent, it
    only occurs occasionally and really screws things up when it does.

    If this is return or control characters could anyone point me to some
    literature on how to filter this stuff out in java.

    Thanks for any help,
    Rich

  • Raymond DeCampo

    #2
    Re: SAXparseExcepti on from Clipboard text

    Rich Sweeny wrote:[color=blue]
    > Hi,
    >
    > I have a program that is being used on Mac's and PC's. The Mac's are running
    > OSX. The user can copy and paste text from the clipboard into a JTextArea
    > which is part of a form. Sometimes when the text comes from the clipboard
    > there is a hollow box at the end. This box cannot be selected. I am using
    > the DecodeXML and EncodeXML methods to save files to disk until the user
    > decides to save the files to a database. When these files are written or
    > read from disk I receive this error:
    >
    > 'org.xml.sax.SA XParseException : Illegal XML character: �.'
    >
    > Does anyone have a clue as to what � translates to? What is this that is
    > coming from the clipboard. This is text that is being copied from one
    > application to a java textfield all on a Mac. This is not persistent, it
    > only occurs occasionally and really screws things up when it does.
    >
    > If this is return or control characters could anyone point me to some
    > literature on how to filter this stuff out in java.
    >[/color]

    The � is your XML creator's way of trying to encode the character
    represented by the number 0. Unfortunately, you cannot use this
    encoding scheme to encode characters with numeric values less than some
    number (I think 20, check the XML specification at w3c.org if you need
    the exact number).

    So it appears that whatever code is creating the XML is broken.

    HTH,
    Ray

    --
    XML is the programmer's duct tape.

    Comment

    • Rich Sweeny

      #3
      Re: SAXparseExcepti on from Clipboard text

      On 3/16/05 7:02 AM, in article YeVZd.83503$vK5 .74277@twister. nyroc.rr.com,
      "Raymond DeCampo" <nospam@twcny.r r.com> wrote:
      [color=blue]
      > Rich Sweeny wrote:[color=green]
      >> Hi,
      >>
      >> I have a program that is being used on Mac's and PC's. The Mac's are running
      >> OSX. The user can copy and paste text from the clipboard into a JTextArea
      >> which is part of a form. Sometimes when the text comes from the clipboard
      >> there is a hollow box at the end. This box cannot be selected. I am using
      >> the DecodeXML and EncodeXML methods to save files to disk until the user
      >> decides to save the files to a database. When these files are written or
      >> read from disk I receive this error:
      >>
      >> 'org.xml.sax.SA XParseException : Illegal XML character: &#x0;.'
      >>
      >> Does anyone have a clue as to what &#x0; translates to? What is this that is
      >> coming from the clipboard. This is text that is being copied from one
      >> application to a java textfield all on a Mac. This is not persistent, it
      >> only occurs occasionally and really screws things up when it does.
      >>
      >> If this is return or control characters could anyone point me to some
      >> literature on how to filter this stuff out in java.
      >>[/color]
      >
      > The &#x0; is your XML creator's way of trying to encode the character
      > represented by the number 0. Unfortunately, you cannot use this
      > encoding scheme to encode characters with numeric values less than some
      > number (I think 20, check the XML specification at w3c.org if you need
      > the exact number).
      >
      > So it appears that whatever code is creating the XML is broken.
      >
      > HTH,
      > Ray[/color]

      Would it use this if it does not know what something is. I should have been
      clearer on the methods I am using to read and write the xml. I am using the
      classes that come with the API.

      import java.beans.XMLD ecoder;
      import java.beans.XMLE ncoder;

      Thanks

      Comment

      Working...