Hi to all, I have a little problem (if it's a problem) with JXTG and Sax, I try to resume the behaviour.
My transfomer build a Document with a structure like this: <sm:root xmlns:sm="http://www.foo.com/"> <sm:header> <sm:trace-id>test</sm:trace-id> <sm:protocol>XML</sm:protocol> <sm:application>xyz</sm:application> <sm:service-id xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="puei:service-id"> <puei:channel xmlns:puei="http://www.bar.com/">06</puei:channel> <puei:product xmlns:puei="http://www.bar.com/">XYZ_zyx</puei:product> <puei:method xmlns:puei="http://www.bar.com/">modify</puei:method> </sm:service-id> </sm:header> ... ... </sm:root> this is well-formed and it's correct, but I need to validate it with a XSD Schema, so I must add a namespace declaration for prefix "puei" in <sm:service-id> or parent element otherwise It cannot *known* the prefix specified in "xsi:type" attribute. I add a namespace declaration with this code: Attr nameSpace = newDoc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:" + newPrefix); nameSpace.setValue(newNS); ((Element) root).setAttributeNode(nameSpace); where newPrefix's value is "puei" and "http://www.bar.com/" for newNS. If I serialize the document it seems ok, with namespace declared in the right way. The result of this transformer is taken from a flow, that call a match with sendPage(), this match has a jxtg with a jx:out dealing with a Document received from flow. But this generate an Exception: DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces. following the stacktrace it was throw when JXTG try to serialize it with DOMStreamer.stream(). Now I don't know if I missing something when add namespace declaration (is it the correct mode?) or if there is a problem in DOMStreamer. Any hint? TIA -- Daniele Madama Pro-netics s.r.l. Via Elio Lampridio Cerva 127/c Roma Tel. 0651530849 http://www.pro-netics.com
