# in XML string

Discussion in 'XML' started by dmckeon@ameritas.com, Jun 15, 2006.

  1. Guest

    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
    , Jun 15, 2006
    #1
    1. Advertising

  2. 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. 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.


    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/
    Martin Honnen, Jun 15, 2006
    #2
    1. Advertising

  3. Guest

    Martin Honnen wrote:
    > 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. 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.

    >
    > 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/


    Thanks for the reply. Do you know why my string might be getting cut
    off at "#"?
    , Jun 15, 2006
    #3
  4. wrote:

    > Do you know why my string might be getting cut
    > off at "#"?


    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/
    Martin Honnen, Jun 15, 2006
    #4
  5. Andy Dingley Guest

    wrote:
    > Martin Honnen wrote:
    > > 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.


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


    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.
    Andy Dingley, Jun 15, 2006
    #5
  6. Guest

    Andy Dingley <> wrote:
    > wrote:
    > > Martin Honnen wrote:
    > > > 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.

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

    >
    > 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.


    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
    , Jun 15, 2006
    #6
  7. 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
    Joe Kesselman, Jun 15, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bomb Diggy
    Replies:
    0
    Views:
    433
    Bomb Diggy
    Jul 28, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    717
    Tony Prichard
    Dec 12, 2003
  3. Kee Nethery
    Replies:
    12
    Views:
    2,051
    Stefan Behnel
    Jun 27, 2009
  4. Matt
    Replies:
    3
    Views:
    331
    Bob Barrows [MVP]
    Apr 23, 2004
  5. Erik Wasser
    Replies:
    5
    Views:
    437
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page