简体   繁体   English

如何将java类的String转换为xsd:string类型?

[英]how to convert java class String to xsd:string type?

The following code returns java.lang.string and I want it to be xsd:string , how can it be done? 以下代码返回java.lang.string ,我希望它是xsd:string ,如何完成?

Element e = getDocumentBuilder().newDocument().createElement("value");
e.setAttribute("type", v.getClass().toString());

in general, how can i convert any class to xsd:type ? 通常,我如何将任何类转换为xsd:type?

I'm confused by your question because xsd:string maps directly (from an XSD/xml file) to a java.lang.String. 我对您的问题感到困惑,因为xsd:string直接(从XSD / xml文件)映射到java.lang.String。 See: 看到:

http://docs.oracle.com/javaee/5/tutorial/doc/bnazq.html http://docs.oracle.com/javaee/5/tutorial/doc/bnazq.html

Therefore, if you are in Java, then you would use java.lang.String everywhere you want an 'xsd:string'. 因此,如果您使用Java,则可以在需要“ xsd:string”的任何地方使用java.lang.String。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM