我們試圖通過JAVA API向MarkLogic插入ISO編碼的xml,但得到此錯誤。 XML包含特殊字符,例如:註冊商標標誌 - <H4>®</H4 >無法通過JAVA API向Marklogic編寫xml和ISO編碼
Bad Request. Server Message: XDMP-DOCUTF8SEQ: Invalid UTF-8 escape sequence at line 14145 -- document is not UTF-8 encoded.
代碼:
DatabaseClient client = DatabaseClientFactory.newClient(IP, PORT,
DATABASE_NAME, USERNAME, PWD, Authentication.DIGEST);
// acquire the content
InputStream xmlDocStream = XMLController.class.getClassLoader()
.getResourceAsStream("path to xml file");
// create a manager for XML documents
XMLDocumentManager xmlDocMgr = client.newXMLDocumentManager();
// create a handle on the content
InputStreamHandle xmlhandle = new InputStreamHandle(xmlDocStream);
// write the document content
xmlDocMgr.write("/" + filename, xmlhandle);
和代碼是...? – fge
如果我們使用mlcp(marklogic content pump)加載這個xml,我們會得到相同的錯誤 –
是的,代碼是...? – fge