marshalling

XML unable to create JAXBContext on marshal [duplicate]

前提是你 提交于 2019-12-24 18:28:33
问题 This question already has an answer here : JAXBContext and @XmlRootElement cause error (1 answer) Closed last year . I have a POJO(in Kotlin) that I wanted to change into XML but i having problem going through the JAXBContext.newInstance(myObj::class.java) part Just view/reply it in Java/Kotlin also can Here's my code on marshalling val context = JAXBContext.newInstance(WxPayOrder::class.java) val m = context.createMarshaller() m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true) val sw =

org.omg.CORBA.MARSHAL: Server-side Exception: null

谁说我不能喝 提交于 2019-12-24 18:06:12
问题 I'm trying to register to a CORBA CosNotification Service. In the documentation of the service I'm trying to connect to, it says I have to a CosNotifyComm::SequencePushConsumer object, and attach it to the notification service. I've included my code, and the error I'm getting back. AlarmClient.java import NotificationIRPSystem.*; import org.omg.CosNotification.*; import org.omg.CosNotifyComm.*; import org.omg.CosNotifyChannelAdmin.*; import org.omg.CosNotifyFilter.*; import org.omg.CosNaming.

JAXB: marshal/unmarshal different XML elements to/from one class

我是研究僧i 提交于 2019-12-24 14:10:01
问题 Let's say, I have the following class: @XmlRootElement class Payment { @XmlElement int amount; @XmlElement Currency currency; @XmlElement IResponse response; } If response==null - the element is a "request", otherwise - the element is a "response". When a request, the element should be (un)marshaled to (from) the root element called PaymentRequest , when a response - to (from) PaymentResponse . How can I configure such marshaling algorithm? If JAXB can't do it, maybe some other engine can?

Exception in thread “main” javax.xml.bind.JAXBException: class nor any of its super class is known to this context

﹥>﹥吖頭↗ 提交于 2019-12-24 13:26:41
问题 Can some help me why below is thrown Exception in thread "main" javax.xml.bind.JAXBException: class com.jaxb.model.copy.copy.Snapshot nor any of its super class is known to this context. at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:588) at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482) at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323) at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal

Marshaling exception when using jaxb

懵懂的女人 提交于 2019-12-24 12:22:49
问题 I have java code and i'm trying to parse it and store it as XML file on my PC using JAXB but i have a marshaling exception: Exception in thread "main" javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.internal.SAXException2: unable to marshal type "java.lang.String" as an element because it is missing an @XmlRootElement annotation] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:311) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl

Saving Parcelable data

社会主义新天地 提交于 2019-12-24 08:37:58
问题 I have a class which implements Parcelable, and could not implement Serializable because it contains some basic Android classes that I can not modify. Some of the objects in this class are for example Location and PendingIntent (which are all conveniently Parcelable). My problem is saving this information between the instances of my main Activity. Currently, I'm holding a static reference to this class, which works well. But I assume that when I re-install the app, and probably when updates

Marshalling with XSD choice field in class

萝らか妹 提交于 2019-12-24 07:36:09
问题 I use a Java class to generate the WSDL schema dynamically. I have this as one of my fields: @XmlElements({ @XmlElement(name = "A", type = String.class), @XmlElement(name = "B", type = Integer.class), @XmlElement(name = "C", type = String.class), @XmlElement(name = "D", type = String.class) }) protected Object aOrBOrCOrD; During marshalling, when the single choice property aOrBOrCOrD is set, which tag name(A, B, C or D) would be set in the XML? Since there's only one field which would contain

How to correctly marshal .NET Strings to std::wstrings for native code?

纵然是瞬间 提交于 2019-12-24 06:45:52
问题 I have a third party library which has a class where the constructor takes a std::wstring . The constructor is defined by the third party like this in the header file: Something(const std::wstring &theString); My header file has this: extern "C" __declspec(dllexport) ThirdParty::Something* createSomething(const std::wstring &theString); My implementation is like this: ThirdParty::Something* Bridge::createSomething(const std::wstring &theString) { return new ThirdParty::Something(theString); }

Correct use of SafeHandles in this P/Invoke use case

橙三吉。 提交于 2019-12-24 06:03:58
问题 Working in C# with a native Dll, that uses opaque handles and internal reference counting, I have the following P/Invoke signatures (all decorated with DllImport attribute) [DllImport("somedll.dll"] public extern IntPtr getHandleOfA(IntPtr handleToB, int index); //(1) public extern IntPtr makeNewHandleOfA(); //(2) public extern void addRefHandleToA(IntPtr handleToA); //(3) public extern void releaseHandleToA(IntPtr handleToA); //(4) public extern void doSomethingWithHandle(IntPtr handleToA) /

Object XML mapping in Android

寵の児 提交于 2019-12-24 03:29:31
问题 I am developing a client-server Model-based application in which client is in Android and server in PHP. I want to transfer product information for example Name,Price,Description, from client to server. I have read that through marshaling/unmarshaling or serialization it can be achieved but all tutorials and example are in Java. But I need in Android. Please guide me to implement in Android. Or there is any other way to implement? Any example will b appreciated. Thanks. 回答1: Have a look on