# in XML string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dmckeon@ameritas.com

    #1

    # in XML string

    I have an XML string that contains a "#" character. I am passing the
    string to a JSP page and it reads up to the character before the "#"
    but nothing after that. I am new to this, so I was wondering if "#" is
    an escape sequence and if there is a way to get it into my string.

    Thanks,
    Dan

  • Martin Honnen

    #2
    Re: # in XML string



    dmckeon@amerita s.com wrote:
    [color=blue]
    > I have an XML string that contains a "#" character. I am passing the
    > string to a JSP page and it reads up to the character before the "#"
    > but nothing after that. I am new to this, so I was wondering if "#" is
    > an escape sequence and if there is a way to get it into my string.[/color]

    XML uses the ampersand '&' to start character or entity references. '#'
    is not used as an escape character in XML.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • dmckeon@ameritas.com

      #3
      Re: # in XML string


      Martin Honnen wrote:[color=blue]
      > dmckeon@amerita s.com wrote:
      >[color=green]
      > > I have an XML string that contains a "#" character. I am passing the
      > > string to a JSP page and it reads up to the character before the "#"
      > > but nothing after that. I am new to this, so I was wondering if "#" is
      > > an escape sequence and if there is a way to get it into my string.[/color]
      >
      > XML uses the ampersand '&' to start character or entity references. '#'
      > is not used as an escape character in XML.
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]

      Thanks for the reply. Do you know why my string might be getting cut
      off at "#"?

      Comment

      • Martin Honnen

        #4
        Re: # in XML string



        dmckeon@amerita s.com wrote:
        [color=blue]
        > Do you know why my string might be getting cut
        > off at "#"?[/color]

        No idea really, you will need to provide more details on what it looks
        like and what "pass string to JSP page" means. It could be that you pass
        the string in a URL and in the URL the '#' has a special meaning as a
        fragment identifier.

        --

        Martin Honnen
        http://JavaScript.FAQTs.com/

        Comment

        • Andy Dingley

          #5
          Re: # in XML string


          dmckeon@amerita s.com wrote:[color=blue]
          > Martin Honnen wrote:[color=green]
          > > dmckeon@amerita s.com wrote:
          > >[color=darkred]
          > > > I have an XML string that contains a "#" character. I am passing the
          > > > string to a JSP page and it reads up to the character before the "#"
          > > > but nothing after that.[/color][/color][/color]
          [color=blue]
          > Thanks for the reply. Do you know why my string might be getting cut
          > off at "#"?[/color]

          What do you mean by "passing the string to a JSP page" ?

          If you mean "I use the string as a HTTP URL", which seems unrelated to
          XML but very likely as something to pass to JSP, then the # character
          is significant in HTTP. It marks the end of the "page" in the URL and
          the beginning of the "fragment identifier". Although they're both
          available to JSP, they'll be split up.

          It sounds like you need to think a bit more carefully about the
          application design here - we don't have enough information to go on
          this much alone. Why do you want to pass a string at all ? What is
          this string, a URL or an opaque parameter that you're passing (for
          instance) as a query parameter? If it's a string, then use some sort of
          URLEncode() function (most web server programming languages have one)
          to map '#' onto '%23' (and also ' ' to '%20' etc.).

          I doubt very much if this problem is XML related.

          Comment

          • dmckeon@ameritas.com

            #6
            Re: # in XML string


            Andy Dingley <dingbat@codesm iths.com> wrote:[color=blue]
            > dmckeon@amerita s.com wrote:[color=green]
            > > Martin Honnen wrote:[color=darkred]
            > > > dmckeon@amerita s.com wrote:
            > > >
            > > > > I have an XML string that contains a "#" character. I am passing the
            > > > > string to a JSP page and it reads up to the character before the "#"
            > > > > but nothing after that.[/color][/color]
            >[color=green]
            > > Thanks for the reply. Do you know why my string might be getting cut
            > > off at "#"?[/color]
            >
            > What do you mean by "passing the string to a JSP page" ?
            >
            > If you mean "I use the string as a HTTP URL", which seems unrelated to
            > XML but very likely as something to pass to JSP, then the # character
            > is significant in HTTP. It marks the end of the "page" in the URL and
            > the beginning of the "fragment identifier". Although they're both
            > available to JSP, they'll be split up.
            >
            > It sounds like you need to think a bit more carefully about the
            > application design here - we don't have enough information to go on
            > this much alone. Why do you want to pass a string at all ? What is
            > this string, a URL or an opaque parameter that you're passing (for
            > instance) as a query parameter? If it's a string, then use some sort of
            > URLEncode() function (most web server programming languages have one)
            > to map '#' onto '%23' (and also ' ' to '%20' etc.).
            >
            > I doubt very much if this problem is XML related.[/color]

            I think you're correct. It doesn't appear to be an XML issue. I'm
            just trying to put together a quick demo, so I was passing the XML
            string in the URL using a question mark. It's not how I would deploy
            it, but I thought it would be easiest for the demo. I will restructure
            it. Thank you all for your input.

            Dan

            Comment

            • Joe Kesselman

              #7
              Re: # in XML string

              If you're using SAX, remember that contiguous text may be delivered as
              several successive calls to characters(). ("Why does SAX cut off my
              text" is probably the single most frequently asked question...)

              --
              () ASCII Ribbon Campaign | Joe Kesselman
              /\ Stamp out HTML e-mail! | System architexture and kinetic poetry

              Comment

              Working...