Tapestry
  1. Tapestry
  2. TAPESTRY-1600

Cannot render XML from page templates: XML declaration and namespaces are removed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0, 5.0.3, 5.0.4, 5.0.5, 5.0.6, 5.0.7
    • Fix Version/s: 5.0.8
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Rather than HTML, I want my page to return XML (it's an Atom feed).
      I want this:

      <?xml version="1.0" encoding="UTF-8"?>
      <feed xmlns="http://www.w3.org/2005/Atom">...</feed>

      But the response is being rendered like this:

      <feed>...</feed>

      There are two issues:

      • The XML declaration is missing
      • The Atom namespace is being stripped from the <feed> element
      1. namespace-support-586974.diff
        47 kB
        Fernando Padilla
      2. namespace-support-591544.diff
        48 kB
        Fernando Padilla
      3. namespace-support-594707.diff
        47 kB
        Fernando Padilla

        Issue Links

          Activity

          Hide
          Fernando Padilla added a comment -

          This is a patch to include namespace support in Tapestry 5 ( against 5.0.6-SNAPSHOT ).

          It maintains name,qname,uri for elements and attributes coming from a template.
          Adds elementNS methods for writer and Element, but you can't add attributes with name,qname,uri (thought too many api changes). Though you can add attributes that use a prefix, as long as that prefix has been defined earlier.

          It then prints out all elements/attributes using their qnames, and also passes through all xmlns attributes.

          It currently swallows all xmlns attributes that point to the tapestry 5 schema.

          Show
          Fernando Padilla added a comment - This is a patch to include namespace support in Tapestry 5 ( against 5.0.6-SNAPSHOT ). It maintains name,qname,uri for elements and attributes coming from a template. Adds elementNS methods for writer and Element, but you can't add attributes with name,qname,uri (thought too many api changes). Though you can add attributes that use a prefix, as long as that prefix has been defined earlier. It then prints out all elements/attributes using their qnames, and also passes through all xmlns attributes. It currently swallows all xmlns attributes that point to the tapestry 5 schema.
          Hide
          Fernando Padilla added a comment -

          This is the latest patch after I svn'd the latest tapestry, svn: 575535

          Show
          Fernando Padilla added a comment - This is the latest patch after I svn'd the latest tapestry, svn: 575535
          Hide
          Fernando Padilla added a comment -

          I just found a bug in my patch. This is the fixed up patch.

          Show
          Fernando Padilla added a comment - I just found a bug in my patch. This is the fixed up patch.
          Hide
          Fernando Padilla added a comment -

          The patch against the latest svn.

          Show
          Fernando Padilla added a comment - The patch against the latest svn.
          Hide
          Fernando Padilla added a comment -

          New patch adding some more features for XML support!! Proper XML element printing ( no more <br>, but only <br/> ), and support for CDATA elements.

          1) Support for XMLMarkupModel. When when the page has:
          @Meta("tapestry.response-content-type=text/xml")
          a) MarkupModel now has a getDocumentHeader.
          i. It is meant for XMLMarkupModel to output the XML Header: <?xml versio="1.0"?>
          ii. It will also output the Charset if set: <?xml version="1.0" encoding="UTF-8"?>

          2) Support for CDATA:
          a) CDATA is handled as just a normal Text.
          i. does not output CDATA sections, just what's inside.
          ii. but we don't really care, since the output is valid: "<![CDATA[A<A]]>" == "A<A"
          iii. expansions ($

          {expansion}

          ) are now supported inside of CDATA sections.
          b) CDATAToken has been removed, StartCdataToken, EndCdataToken added
          i. to mark when cdata sections were started and ended in the input template
          ii. in the case that we decide to do something with cdata outputting later, but probably will not.

          Show
          Fernando Padilla added a comment - New patch adding some more features for XML support!! Proper XML element printing ( no more <br>, but only <br/> ), and support for CDATA elements. 1) Support for XMLMarkupModel. When when the page has: @Meta("tapestry.response-content-type=text/xml") a) MarkupModel now has a getDocumentHeader. i. It is meant for XMLMarkupModel to output the XML Header: <?xml versio="1.0"?> ii. It will also output the Charset if set: <?xml version="1.0" encoding="UTF-8"?> 2) Support for CDATA: a) CDATA is handled as just a normal Text. i. does not output CDATA sections, just what's inside. ii. but we don't really care, since the output is valid: "<![CDATA [A<A] ]>" == "A<A" iii. expansions ($ {expansion} ) are now supported inside of CDATA sections. b) CDATAToken has been removed, StartCdataToken, EndCdataToken added i. to mark when cdata sections were started and ended in the input template ii. in the case that we decide to do something with cdata outputting later, but probably will not.
          Hide
          Fernando Padilla added a comment -

          The latest patch set against svn: 591544

          Show
          Fernando Padilla added a comment - The latest patch set against svn: 591544
          Hide
          Fernando Padilla added a comment -

          latest patch set agains svn: 591544

          Show
          Fernando Padilla added a comment - latest patch set agains svn: 591544
          Hide
          Fernando Padilla added a comment -

          the latest patch, after the huge formatting change.

          Show
          Fernando Padilla added a comment - the latest patch, after the huge formatting change.
          Hide
          Fernando Padilla added a comment -

          There seems to be interest in this bug from users, but no attention from developers. Some people have asked me to put up my build on a repository so they can play with it and comment. So here is it:

          http://tapestry.happyfern.com/
          http://tapestry.happyfern.com/repository/

          please, if you're interested, give it a whirl and email me.

          Show
          Fernando Padilla added a comment - There seems to be interest in this bug from users, but no attention from developers. Some people have asked me to put up my build on a repository so they can play with it and comment. So here is it: http://tapestry.happyfern.com/ http://tapestry.happyfern.com/repository/ please, if you're interested, give it a whirl and email me.
          Hide
          Howard M. Lewis Ship added a comment -

          Fernando, sorry that you felt like the cold shoulder. As we discussed on the mailing list, things can happen in an odd order in an open source project. Priorities are not always quite top down, as I know I often work on lower priority things that I can accomplish in a set time, rather than more ambitious and over-arching bug fixes.

          Show
          Howard M. Lewis Ship added a comment - Fernando, sorry that you felt like the cold shoulder. As we discussed on the mailing list, things can happen in an odd order in an open source project. Priorities are not always quite top down, as I know I often work on lower priority things that I can accomplish in a set time, rather than more ambitious and over-arching bug fixes.

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              David Peterson
            • Votes:
              12 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development