小编Han*_*ann的帖子

Java Jaxb:意外元素(uri:"",local:"Create").预期的元素是<{} Create>

我的JAXB有一个问题

<element name="create">
    <complexType>
        <sequence>
            <element name="name" type="string"></element>
        </sequence>
    </complexType>
</element>
Run Code Online (Sandbox Code Playgroud)

我的xml:

<Create>
<name> coco </name>
</Create>
Run Code Online (Sandbox Code Playgroud)

我的代码java:

JAXBContext context = JAXBContext.newInstance("MyPackage");
 Unmarshaller decodeur =    context.createUnmarshaller();
System.out.println("text : " + message);
msgObject = decodeur.unmarshal(sr);  
     if (msgObject instanceof Create)

{
      System.out.println(" action");
}
Run Code Online (Sandbox Code Playgroud)

我有这个:

意外元素(uri:"",local:"Create").预期的元素是<{ http://www.example.org/XSD_Maths } create>

我的代码停止了这个:

 msgObject = decodeur.unmarshal(sr);  
Run Code Online (Sandbox Code Playgroud)

我的xml好吗?你能帮帮我吗,因为我不知道是什么问题

java xml jaxb blind unmarshalling

5
推荐指数
1
解决办法
3万
查看次数

在Google Apps脚本中调整图像大小

我有一张图片,我想调整它的大小。

应用脚本代码:

var fileId = 'idImage';
var img = DriveApp.getFileById(fileId).getBlob().;
newFile.getBody().insertImage(0, img); 
Run Code Online (Sandbox Code Playgroud)

对象Blob无法调整大小,因此如何调整图像大小?

问候

google-sites google-apps-script

5
推荐指数
1
解决办法
7192
查看次数

类型安全:未选中从Object转换为JAXBElement <User>

我有一个演员的概率

JAXBElement<User> jaxbElement = (JAXBElement<User>)unmarshaller.unmarshal(sr); 
Run Code Online (Sandbox Code Playgroud)

它不起作用,eveybody可以帮助我吗?


我不能这样做:我告诉你我的代码:

StringReader sr = new StringReader(this.message);
JAXBElement<Utilisateur> jaxbElement = (JAXBElement<Utilisateur>) unmarshaller.unmarshal(sr);   
Run Code Online (Sandbox Code Playgroud)

如果我这样做,我有一个错误,因为我使用StringReader:

JAXBElement<User> jaxbElement = unmarshaller.unmarshal(sr, User.class); 
Run Code Online (Sandbox Code Playgroud)

java xml xsd jaxb

4
推荐指数
1
解决办法
2890
查看次数

标签 统计

java ×2

jaxb ×2

xml ×2

blind ×1

google-apps-script ×1

google-sites ×1

unmarshalling ×1

xsd ×1