In my custom marshaller for a difficult element. Assume this helper method gets the index of the namespace array for "RateSchedule" which is not only the element name but it's in its own namespace e.g., ../RateScheduleV1.
protected int getNamespaceIndex(MarshallingContext context, String elementName) { if(context != null) { final String[] namespaces = context.getNamespaces(); int i = 0; for(final String tempNs : namespaces) { if(tempNs.contains(elementName)) { return i; } i++; } } return 0; } Once I have the index from the context namespace array, I simply try to write out the element "RateSchedule" with this namespace index - but I get the following exception. If the namespaces are in the context array (verified with debugger) why does it complain that the namespace URI is not declared??? --------------------------------------------------------------------------------- nsIdx = getNamespaceIndex() context.startTagAttributes(nsIdx, ELEMENT_NAME).attribute(0, ATTRIBUTE_CODE, value).closeStartContent(); context.endTag(nsIdx, ELEMENT_NAME); --------------------------------------------------------------------------------- Caused by: java.io.IOException: Namespace URI has not been declared. at org.jibx.runtime.impl.GenericXMLWriter.writePrefix(GenericXMLWriter.java:197) at org.jibx.runtime.impl.XMLWriterBase.startTagOpen(XMLWriterBase.java:201) at org.jibx.runtime.impl.MarshallingContext.startTagAttributes(MarshallingContext.java:541) -- View this message in context: http://old.nabble.com/Custom-marshalling---Namespace-URI-has-not-been-declared-tp34647639p34647639.html Sent from the jibx-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users