Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-1592

Refactor XMLWriter startTag to allow arbitrary attributes to be written


    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5, 3.1, 4.0-ALPHA
    • Component/s: None
    • Labels:
    • Environment:

      My MacBook laptop.


      There are certain cases in which a user would like to write arbitrary attributes as part of the XML output for a field tag. Case in point: I'd like to declare tags in the SOLR output that are e.g., georss namespace, like georss:point. Other users may want to declare myns:mytag tags, which should be perfectly legal as SOLR goes. This isn't currently possible with the XMLWriter implementation, which curiously only allows the attribute "name" to be included in the XML tags.

      Coincidentally, users of XMLWriter aren't allowed to modify the <response outer XML tag to include those arbitrary namespaces (which was my original thought as a workaround for this). This wouldn't matter anyways, because by the time the user got to the FieldType#writeXML method, the header for the XML would have been written anyways.

      I've developed a workaround, and in doing so, allowed something that should have probably been allowed in the first place: allow a user to write arbitrary attributes (including xmlns:myns="myuri") as part of the XMLWriter#startTag function. I've kept the existing #startTag, but replaced its innards with versions of startTag that include startTagWithNamespaces, and startTagNoAttrs.


        1. SOLR-1592.patch
          0.9 kB
          Noble Paul
        2. SOLR-1592.patch
          2 kB
          Noble Paul
        3. SOLR-1592.Mattmann.112209.patch.txt
          3 kB
          Chris A. Mattmann
        4. SOLR-1592.Mattmann.112209_02.patch.txt
          4 kB
          Chris A. Mattmann

          Issue Links



              • Assignee:
                noble.paul Noble Paul
                chrismattmann Chris A. Mattmann
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: