Original issue 38 created by ceharris414 on 2013-02-25T12:12:44.000Z:
The org.w3c.dom.Docment does not properly set the namespace URI on document elements when "xmlns" is treated as an ordinary attribute. Consequently, the Document returned by CapXmlBuilder.toXmlDocument(AlertOrBuilder) cannot be validated against its schema definition (using, for example, javax.xml.validation.Validator). The Document.createElementNS(String, String) method must be used to create elements in a particular namespace.
What steps will reproduce the problem?
Construct an Alert or Alert.Builder, using Alert.Builder.setXmlns(String) to set the namespace; e.g. to the value "urn:oasis:names:tc:emergency:cap:1.2"
Build a Document using CapXmlBuilder.toXmlDocument(AlertOrBuilder).
Examine the namespace URI of any element in the Document; e.g. document.getDocumentElement().getNamespaceURI()
What is the expected output? What do you see instead?
The namespaceURI should be the value set by Alert.Builder.setXmlns; e.g. "urn:oasis:names:tc:emergency:cap:1.2"
Instead, the returned namespaceURI is null.
What version of the product are you using? On what operating system?
r3 on linux
Please provide any additional information below.
The CapXmlBuilder should use Document.createElementNS(String, String) instead of Document.createElement(String) when creating each element of the document. The first argument to createElementNS should be the namespace returned by AlertOrBuilder.getXmlns().
See the attached patch for an approach to solving this issue.
Original issue 38 created by ceharris414 on 2013-02-25T12:12:44.000Z:
The org.w3c.dom.Docment does not properly set the namespace URI on document elements when "xmlns" is treated as an ordinary attribute. Consequently, the Document returned by CapXmlBuilder.toXmlDocument(AlertOrBuilder) cannot be validated against its schema definition (using, for example, javax.xml.validation.Validator). The Document.createElementNS(String, String) method must be used to create elements in a particular namespace.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
The namespaceURI should be the value set by Alert.Builder.setXmlns; e.g. "urn:oasis:names:tc:emergency:cap:1.2"
Instead, the returned namespaceURI is null.
What version of the product are you using? On what operating system?
r3 on linux
Please provide any additional information below.
The CapXmlBuilder should use Document.createElementNS(String, String) instead of Document.createElement(String) when creating each element of the document. The first argument to createElementNS should be the namespace returned by AlertOrBuilder.getXmlns().
See the attached patch for an approach to solving this issue.