Uploaded image for project: 'Commons Jelly'
  1. Commons Jelly
  2. JELLY-184

Using namespace-prefixes breaks Jelly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core / taglib.core
    • Labels:
      None

      Description

      Using feature "http://xml.org/sax/features/namespace-prefixes" breaks Jelly.

      SAXParserFactory pf = SAXParserFactory.newInstance();
      pf.setValidating (false);
      pf.setNamespaceAware (true);
      pf.setFeature ("http://xml.org/sax/features/namespace-prefixes", true);
      XMLReader reader = null;
      SAXParser parser = pf.newSAXParser();
      reader = parser.getXMLReader();

      InputSource inSrc = new InputSource
      (new FileReader(new File ("util/test.jelly")));

      Jelly jelly = new Jelly();
      JellyContext context = new JellyContext ();

      ExtXMLParser jellyParser = new ExtXMLParser ();
      jellyParser.setContext(context);
      jellyParser.configure ();

      reader.setContentHandler(jellyParser);
      reader.parse (inSrc);

      Script script = jellyParser.getScript ();
      script.compile ();
      script.run (context, XMLOutput.createXMLOutput(System.out));

      results in:

      [junit] org.apache.commons.jelly.JellyTagException: null:-1:-1: <null>
      null:2:88: <j:jelly> This tag does not understand the '' attribute
      [junit] at
      org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:600)
      [junit] at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:239)
      [junit] at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:89)

      The offending line is "pf.setFeature
      ("http://xml.org/sax/features/namespace-prefixes", true)"

      While setting this feature is, of course, not necessary for Jelly, the Jelly
      script I want to use in the real application is embedded within a larger XML
      file. This file is parsed into a SAX event buffer with the feature set (because
      in general, namespace-prefixes are needed). The SAX events belonging to the
      Jelly script are then "extracted" and fed to Jelly. Of course, I can filter out
      the namespace prefix attributes (and I will, as a workaround). But Jelly should,
      of course, not break because of these attributes being reported.

      • Michael

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                diongillard dion gillard
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: