Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2784

XmlNodePrinter namespace declarations are inserted at incorrect scope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.5.5, 1.5.6
    • 1.5.7, 1.6-beta-2
    • groovy-jdk, XML Processing
    • None
    • groovy 1.5.6, windows xp java 1.5

    Description

      When outputting a document with namespaces the namespace declarations are created at the wrong 'scope' / 'level' in the document.
      The attache Groovy script show that parsing back in a document just created by XmlNodePrinter demostrates this .

      Please see attached and error below:

      [Fatal Error] testout.xml:7:10: The prefix "ns1" for element "ns1:b" is not bound.
      Exception in thread "main" org.xml.sax.SAXParseException: The prefix "ns1" for element "ns1:b" is not bound.
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at groovy.util.XmlParser.parse(XmlParser.java:115)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
      at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:761)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
      at TestPackage.XmlNodePrintNamespaceTestCase.run(XmlNodePrintNamespaceTestCase.groovy:12)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:599)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
      at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:773)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
      at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:402)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95)
      at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:599)
      at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1077)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:744)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
      at TestPackage.XmlNodePrintNamespaceTestCase.main(XmlNodePrintNamespaceTestCase.groovy)

      Attachments

        1. test.xml
          0.2 kB
          Wayne Keenan
        2. testout.xml
          0.2 kB
          Wayne Keenan
        3. XmlNodePrintNamespaceTestCase.groovy
          0.4 kB
          Wayne Keenan
        4. XmlNodePrintNamespaceTestCase2.groovy
          0.6 kB
          Wayne Keenan

        Activity

          People

            paulk Paul King
            wkeenan Wayne Keenan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: