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

时间:2022-06-02 17:15:19

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?

1 个解决方案

#1


0  

I'm confused by your question because xsd:string maps directly (from an XSD/xml file) to a java.lang.String. See:

我对你的问题感到困惑,因为xsd:string直接映射(从XSD / xml文件)到java.lang.String。看到:

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。

#1


0  

I'm confused by your question because xsd:string maps directly (from an XSD/xml file) to a java.lang.String. See:

我对你的问题感到困惑,因为xsd:string直接映射(从XSD / xml文件)到java.lang.String。看到:

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。