Menu

#43 XML output needs to use proper entity reference for &

open
nobody
None
5
2003-07-19
2003-07-19
No

The XML output does not encoded & properly into an
entity as &

Outputting & alone in an XML file is illegal. It must
be output as &

Discussion

  • Mikhail Kruk

    Mikhail Kruk - 2003-07-19

    Logged In: YES
    user_id=173287

    I keep hearing about this, but in my samples & is always
    output as &amp. Please give me a sample file where this is a
    problem.

     
  • Mikhail Kruk

    Mikhail Kruk - 2003-07-19

    Logged In: YES
    user_id=173287

    I keep hearing about this, but in my samples & is always
    output as &amp. Please give me a sample file where this is a
    problem.

     
  • Simon Woodside

    Simon Woodside - 2003-07-19

    Logged In: YES
    user_id=54239

    Yes, I see now that it occurs for me only inside an HTML
    anchor (a href) tag, in the URL. It encodes &'s in the
    regular text OK. I can't provide the example because it's a
    doc I purchased. Here is some output though:

    [simons-tibook:~/sandbox/book2] woodside% grep '&'
    newout.xml.xml
    <text top="317" left="523" width="39" height="20"
    font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&">Here</a></text>
    <text top="718" left="508" width="39" height="20"
    font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1676&">Here</a></text>
    <text top="718" left="547" width="5" height="20" font="4"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1676&">.</a></text>
    <text top="1010" left="316" width="142" height="20"
    font="5"><b>Price:</b><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&">
    $8 PDF at </a></text>
    <text top="1010" left="458" width="110" height="20"
    font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&">RPGnow.com</a></text>
    <text top="1010" left="568" width="5" height="20"
    font="4"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&">.</a></text>
    <text top="454" left="683" width="38" height="17"
    font="9"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&">http://</a></text>
    <text top="472" left="160" width="362" height="17"
    font="9"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&">www.rpgnow.com/product_info.php?products_id=711&</a></text>
    <text top="148" left="88" width="136" height="15"
    font="13">Architects & Engineers</text>
    <text top="197" left="88" width="139" height="15"
    font="13">Armorers & Locksmiths</text>
    <text top="417" left="88" width="89" height="15"
    font="13">Bookbinders &</text>
    <text top="514" left="88" width="122" height="15"
    font="13">Bowyers & Fletchers</text>
    <text top="535" left="88" width="123" height="15"
    font="13">Brewers, Distillers, &</text>
    <text top="919" left="88" width="132" height="15"
    font="13">Clay & Stone Workers</text>
    <text top="149" left="471" width="101" height="15"
    font="13">Clerks & Scribes</text>
    <text top="200" left="471" width="139" height="15"
    font="13">Clothing & Accessories</text>
    <text top="453" left="471" width="104" height="15"
    font="13">Dyers & Weavers</text>
    <text top="757" left="471" width="104" height="15"
    font="13">Forgers & Smiths</text>
    <text top="956" left="471" width="110" height="15"
    font="13">Harness Makers &</text>
    <text top="273" left="466" width="118" height="15"
    font="13">Music & Performers</text>
    <text top="671" left="466" width="115" height="15"
    font="13">Skinners & Tanners</text>
    <text top="412" left="84" width="88" height="15"
    font="13">Map Makers &</text>
    [simons-tibook:~/sandbox/book2] woodside%
    [simons-tibook:~/sandbox/book2] woodside% xmllint
    newout.xml.xml
    newout.xml.xml:30: error: xmlParseEntityRef: no name
    t="20" font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&

    ^
    newout.xml.xml:47: error: xmlParseEntityRef: no name
    ="20" font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1676&

    ^
    newout.xml.xml:48: error: xmlParseEntityRef: no name
    ="20" font="4"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1676&

    ^
    newout.xml.xml:56: error: xmlParseEntityRef: no name
    "><b>Price:</b><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&

    ^
    newout.xml.xml:57: error: xmlParseEntityRef: no name
    ="20" font="6"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&

    ^
    newout.xml.xml:58: error: xmlParseEntityRef: no name
    ="20" font="4"><a
    href="http://www.rpgnow.com/product_info.php?products_id=1761&

    ^
    newout.xml.xml:193: error: xmlParseEntityRef: no name
    t="17" font="9"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&

    ^
    newout.xml.xml:194: error: xmlParseEntityRef: no name
    t="17" font="9"><a
    href="http://www.rpgnow.com/product_info.php?products_id=711&

    ^
    [simons-tibook:~/sandbox/book2] woodside%

     
  • Mikhail Kruk

    Mikhail Kruk - 2003-07-19

    Logged In: YES
    user_id=173287

    aaah, in the urls... that's interesting. Do you think making
    URLs CDATA is a good idea? Or should I change it to &amp in
    URLs? Not sure what to do here.

     
  • Simon Woodside

    Simon Woodside - 2003-07-19

    Logged In: YES
    user_id=54239

    I've never used CDATA, I just use & in URLs

     

Log in to post a comment.