DomElementMapper/DomMapperBase should always accurately marshal out what you supply. In the case of namespaces, this does require that the namespaces are declared, either in the binding definition or in the element (as attributes, which is how DOM represents namespace declarations). It'd also be possible to automatically create a namespace declaration attribute if one isn't found and the namespace isn't in the binding definition; that might be a good thing for DomElementMapper/DomMapperBase to do in the future. If you like this idea, enter it as an enhancement request.
- Dennis
Tilman Linden wrote:
The namespace of my elements *is* undeclared. The elements i want to
marshal are created from a Document beginning with
<rootNode xmlns:xsi="..." xsi:noNamespaceSchemaLocation="...."> ...
So I just want the DomElementMapper to ignore Namespaces completely. Ok, i think this is not a major issue for the JiBX development, so i do not want to waste your time and try to build a workaround based on the existing code.
Tilman
Am Mo, den 05.07.2004 schrieb Dennis Sosnoski um 19:36:
It looks like the element you're trying to marshal has an undeclared namespace. If the namespace for the element is declared in the binding definition for a containing element it should be found automatically; otherwise, you need to have the namespace declaration on the DOM Element itself. DOM represents namespace declarations as attributes which have to use a particular namespace - this is one of the ugly sides of DOM (there are several!).
If you think you have the namespace declared either in the binding definition or in the DOM itself you can step through the code in DomMapperBase.marshalElement prior to the exception where I'm trying to find all the added namespaces. If it's declared in the binding definition the call to findNamespaceIndex(prefix, uri); is supposed to find it; otherwise, if it's an attribute of the DOM Element the loop the follows should find it.
This should really give a better error message - feel free to add a low-priority enhancement request to the Jira just for the error message alone.
- Dennis
Tilman Linden wrote:
hi,
i wanted to use the DomElementMapper provided in the extras package. unfortunately, i always get an ArrayIndexOutOfBoundException when marshalling an Element... Seems to have something to do with namespace indices, but could not figure out any details...
i am using jibx beta3c now. any explanations / fixes / workarounds would be appreciated!
greetings,
tilman
java.lang.ArrayIndexOutOfBoundsException: -1 at org.jibx.runtime.impl.StreamWriterBase.writePrefix(StreamWriterBase.java:242) at org.jibx.runtime.impl.XMLWriterBase.startTagOpen(XMLWriterBase.java:191) at org.jibx.extras.DomMapperBase.marshalElement(DomMapperBase.java:235) at org.jibx.extras.DomElementMapper.marshal(DomElementMapper.java:129) at de.fhrg.jobhandler.GridResource.JiBX_GridJobBinding_marshal_1_0(GridResource.java) at de.fhrg.jobhandler.JiBX_MungeAdapter.JiBX_GridJobBinding_marshal_1_0() at de.fhrg.jobhandler.GJobDLDocument.JiBX_GridJobBinding_marshal_1_0(GJobDLDocument.java) at de.fhrg.jobhandler.GJobDLGridJob.JiBX_GridJobBinding_marshal_3_0(GJobDLGridJob.java) at de.fhrg.jobhandler.JiBX_GridJobBindingGJobDLGridJob_access.marshal() at de.fhrg.jobhandler.GJobDLGridJob.marshal(GJobDLGridJob.java) at org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:919) at org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:967) at de.fhrg.jobhandler.persistence.jibx.JiBX_GJobDLWriter.store(JiBX_GJobDLWriter.java:77) at de.fhrg.jobhandler.persistence.GJobDLWriter.propertyChange(GJobDLWriter.java:70) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:252) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:299) at de.fhrg.jobhandler.GJobDLGridJob.run(GJobDLGridJob.java:265)
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users
