XMLStreamWriter.writeStartElement(prefix,localName,namespaceURI), Prefix "manifest" can not be resolved to namespace URI
source.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <zip:archive xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"     xmlns:zip="com.test.zip">
    <zip:entry zip:target="test1.xml"><manifest:manifest>aaa</manifest:manifest></zip:entry>
    <zip:entry zip:target="test2.xml">.......</zip:entry>
    </zip:archive>

I use javax.xml.stream.XMLStreamReader to read source.xml file, do some action, and then write to disk according to the attribute value of zip:target.

the result file, test1.xml:
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>aaa</manifest:manifest>
You know, it is wrong. Prefix "manifest" can not be resolved to namespace URI.

Through the debugging, I found the following statement was successfully called.
XMLStreamWriter.writeStartElement("manifest", "manifest", "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");

The third parameter of writeStartElement is not null. But why is the namespace missing in the result file?

I tried two methods:
1) set sRepairingNamespaces to be true
2) add writeNamespace after writeStartElement 
But new trouble come, the namespaces were redeclared and duplicate.

Thanks.


XMLStreamWriter.writeStartElement(prefix,localName,namespaceURI), Prefix "manifest" can not be resolved to namespace URI
===

source.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <zip:archive xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"     xmlns:zip="com.test.zip">
    <zip:entry zip:target="test1.xml"><manifest:manifest>aaa</manifest:manifest></zip:entry>
    <zip:entry zip:target="test2.xml">.......</zip:entry>
    </zip:archive>

I use javax.xml.stream.XMLStreamReader to read source.xml file, do some action, and then write to disk according to the attribute value of zip:target.

the result file, test1.xml:
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>aaa</manifest:manifest>
You know, it is wrong. Prefix "manifest" can not be resolved to namespace URI.

Through the debugging, I found the following statement was successfully called.
XMLStreamWriter.writeStartElement("manifest", "manifest", "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0");

The third parameter of writeStartElement is not null. But why is the namespace missing in the result file?

I tried two methods:
1) set sRepairingNamespaces to be true
2) add writeNamespace after writeStartElement 
But new trouble come, the namespaces were redeclared and duplicate.

Thanks.

