小编vg1*_*123的帖子

从jaxb生成的xml中删除standalone ="yes"

public final String getMessage() {
            JAXBContext jaxbContext;
            StringWriter sw = new StringWriter();
            try {
                jaxbContext = JAXBContext.newInstance(Login.class);        
                Marshaller jaxbMarshaller = jaxbContext.createMarshaller();

                jaxbMarshaller.setProperty("jaxb.encoding", "ISO-8859-1");                      
                        jaxbMarshaller.marshal(this, sw);
            } catch (JAXBException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return sw.toString();
        }
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的代码..我得到的输出如下.

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
Run Code Online (Sandbox Code Playgroud)

这里我想删除standalone ="yes"并希望输出为

<?xml version="1.0" encoding="ISO-8859-1"?>
Run Code Online (Sandbox Code Playgroud)

我检查了链接 JAXB - 从生成的XML中删除'standalone ="yes"' 但这里的答案正在删除完成

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Run Code Online (Sandbox Code Playgroud)

部分

我不希望那样......

请帮我..

java xml formatting jaxb jaxb2

6
推荐指数
1
解决办法
2万
查看次数

如何在postgres函数中使用EXECUTE FORMAT ... USING

CREATE OR REPLACE FUNCTION dummytest_insert_trigger()
  RETURNS trigger AS
$BODY$
DECLARE
v_partition_name    VARCHAR(32);
        BEGIN
        IF NEW.datetime IS NOT NULL THEN
                v_partition_name := 'dummyTest';            
                EXECUTE format('INSERT INTO %I VALUES ($1,$2)',v_partition_name)using NEW.id,NEW.datetime;              
                END IF;                    
           RETURN NULL;
        END;
        $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION dummytest_insert_trigger()
  OWNER TO postgres;
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用insert插入dummyTest值(1,'2013-01-01 00:00:00 + 05:30');

但它显示错误

ERROR: function format(unknown) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Context: PL/pgSQL …
Run Code Online (Sandbox Code Playgroud)

format postgresql using execute

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

标签 统计

execute ×1

format ×1

formatting ×1

java ×1

jaxb ×1

jaxb2 ×1

postgresql ×1

using ×1

xml ×1