sql - Merge two xml strings in java -
i'm trying merge/combine 2 xml strings got parsing object xml using castor marshalling/unmarshalling. here 2 xml strings have:
<?xml version="1.0" encoding="utf-8"?> <abc:abcresponse xmlns:abc="http://www.abc.com/schema/abctransaction"> <abc:code>0</abc:code> <abc:description>blah</abc:description> </abc:abcresponse> <?xml version="1.0" encoding="utf-8"?> <abc:abcrequest xmlns:abc="http://www.abc.com/schema/abctransaction"> <abc:id>99999</abc:id> <abc:idstring>abc</abc:idstring> </abc:abcrequest>
i want able combine these 2 strings 1 can insert database (mssql) column has data type xml. tried using solution suggested link java merge 2 xml strings in java, doesn't seem recognize valid xml string since no records inserted database table, , there's error in console:
com.microsoft.sqlserver.jdbc.sqlserverexception: xml parsing: line 1, character 12, text/xmldecl not @ beginning of input
if insert either of these strings separately database column new record added fine.
anyone has idea how properly? thanks!
you should create following ("abctransaction" wild guess).
<?xml version="1.0" encoding="utf-8"?> <abc:abctransaction xmlns:abc="http://www.abc.com/schema/abctransaction"> <abc:abcrequest> <abc:id>99999</abc:id> <abc:idstring>abc</abc:idstring> </abc:abcrequest> <abc:abcresponse> <abc:code>0</abc:code> <abc:description>blah</abc:description> </abc:abcresponse> </abc:abctransaction>
maybe leaving out xmlns , "abc:" parts.
Comments
Post a Comment