XML problem with url value &F&

Discussion in 'XML' started by gg, Mar 24, 2007.

  1. gg

    gg Guest

    I specify the Url element as
    <xsd:element name="Url">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="512"/>
    <xsd:pattern value="http://[a-zA-z.\\_\-]+"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    in the xsd but When I use the following in the xml

    <Url>https://www.xyz.com/cgi-bin/access/abccgi3m01?F6=1\&F7=IB&F21=IB&F22=IB
    &REQUEST=ClientSignin&LANGUAGE=ENGLISH</Url>


    I got the error message
    The reference to entity "F7" must end with the ';' delimiter. [17]
    so I tried surrounding the url with double quote, then tried \ before &f7
    but no luck. even \\&f7 did not help

    tried google on a number of search terms but no luck so far
     
    gg, Mar 24, 2007
    #1
    1. Advertising

  2. In article <PFgNh.8212$__3.1414@edtnps90>, gg <> wrote:

    >I specify the Url element as
    > <xsd:element name="Url">


    .... it's nothing to do with the schema.

    >in the xsd but When I use the following in the xml
    >
    ><Url>https://www.xyz.com/cgi-bin/access/abccgi3m01?F6=1\&F7=IB&F21=IB&F22=IB
    >&REQUEST=ClientSignin&LANGUAGE=ENGLISH</Url>


    You can't do that in XML. You have to replace your ampersands with
    "&amp;".

    -- Richard
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
     
    Richard Tobin, Mar 24, 2007
    #2
    1. Advertising

  3. gg

    gg Guest

    thank you. I just have to remember replacing & with &amp;.


    "Richard Tobin" <> wrote in message
    news:eu472r$11k7$...
    > In article <PFgNh.8212$__3.1414@edtnps90>, gg <> wrote:
    >
    > >I specify the Url element as
    > > <xsd:element name="Url">

    >
    > ... it's nothing to do with the schema.
    >
    > >in the xsd but When I use the following in the xml
    > >

    >
    ><Url>https://www.xyz.com/cgi-bin/access/abccgi3m01?F6=1\&F7=IB&F21=IB&F22=I

    B
    > >&REQUEST=ClientSignin&LANGUAGE=ENGLISH</Url>

    >
    > You can't do that in XML. You have to replace your ampersands with
    > "&amp;".
    >
    > -- Richard
    > --
    > "Consideration shall be given to the need for as many as 32 characters
    > in some alphabets" - X3.4, 1963.
     
    gg, Mar 24, 2007
    #3
  4. gg

    Simon Brooke Guest

    in message <PFgNh.8212$__3.1414@edtnps90>, gg ('') wrote:

    > I specify the Url element as
    > <xsd:element name="Url">
    > <xsd:simpleType>
    > <xsd:restriction base="xsd:string">
    > <xsd:maxLength value="512"/>
    > <xsd:pattern value="http://[a-zA-z.\\_\-]+"/>
    > </xsd:restriction>
    > </xsd:simpleType>
    > </xsd:element>
    > in the xsd but When I use the following in the xml
    >
    >

    <Url>https://www.xyz.com/cgi-bin/access/abccgi3m01?F6=1\&F7=IB&F21=IB&F22=IB
    > &REQUEST=ClientSignin&LANGUAGE=ENGLISH</Url>
    >
    >
    > I got the error message
    > The reference to entity "F7" must end with the ';' delimiter. [17]
    > so I tried surrounding the url with double quote, then tried \ before
    > &f7 but no luck. even \\&f7 did not help


    The (traditional) use of ampersand as a parameter-value pair separator in
    URLs is a mistake. Many (but not all) dynamic content toolkits allow the
    use of other characters, for example semi-colon, which do not provoke this
    problem. However, if you must use ampersand, the correct way of writing
    ampersand in an XML document is '&amp;'. So you will find that

    <Url>https://www.xyz.com/cgi-bin/access/abccgi3m01?F6=1\&amp;F7=IB&amp;F21=IB&amp;F22=IB
    &amp;REQUEST=ClientSignin&amp;LANGUAGE=ENGLISH</Url>

    will work.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    ;; 'I think we should trust our president in every decision
    ;; that he makes and we should just support that'
    ;; Britney Spears of George W Bush, CNN 04:09:03
     
    Simon Brooke, Mar 25, 2007
    #4
    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. Jon paugh
    Replies:
    1
    Views:
    861
  2. jkflens
    Replies:
    2
    Views:
    1,515
    jkflens
    May 30, 2006
  3. Just D.
    Replies:
    0
    Views:
    502
    Just D.
    Aug 11, 2004
  4. Tim Fröglich

    Getting ID, calling url, search for value, return value

    Tim Fröglich, Jan 7, 2006, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    149
    Josh Twist
    Jan 10, 2006
  5. Erik Wasser
    Replies:
    5
    Views:
    484
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page