« Return to Thread: MOXy: Marshalling with no namespace prefix?
Hi Matt, That's great news! Can you point me to the bug so I can watch for it? Thanks for your quick response. --Polly Matt MacIvor wrote:Hi Polly, EclipseLink doesn't currently support the default namespace for marshalling. We require a prefix for any namespace that's used. However, there is already a work item to add support for this, so it will be coming in the near future. -MattHi, I have read the documentation about namespace resolution many times now (http://wiki.eclipse.org/Using_Workbench_(ELUG)#How_to_Configure_XML_Schema_Namespace), but I am still unsure of how to do what I want to do. Please bear with me if this is a stupid question. My schema is defined like this: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.foo.com/bar/baz" targetNamespace="http://www.foo.com/bar/baz"elementFormDefault="qualified"attributeFormDefault="unqualified"> My document is like this: <Address xmlns='http://www.foo.com/bar/baz' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='...' > <LineOne>101 Main Street</LineOne> <LineTwo>Apt 514</LineTwo> <City>Malibu</City> <State>CA</State> <Country>USA</Country> <PostalCode>90914-2938</PostalCode> </Address> It appears that when unmarshalling the document, EclipseLink searches foranentry in the XMLContext that contains both the namespace and the element name. So to tell EclipseLink the association between the namespace URLandthe element, I found through trial and error to configure EclipseLinkusingthese options: Namespace URL Prefix Declare http://www.foo.com/bar/baz ns1 true Then my document unmarshalls correctly and everything's great! Unfortunately, I found that when I marshall the object back out, all the elements have the namespace prefix, like "ns1:Address". Thedocumentationregarding the Prefix field says: "When the EclipseLink runtime marshalls (writes) an object to an XML document, it uses the namespace prefixes you specify here." But what if I don't want to use the prefix? We defined the targetnamespaceso that our documents do not have to use the prefix and can be cleaner.Isthere a way to configure things so that marshalling does not use theprefix?Thanks! --Polly_______________________________________________ eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users
« Return to Thread: MOXy: Marshalling with no namespace prefix?
| Free embeddable forum powered by Nabble | Forum Help |