1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { paramMock } from "../utils" 17 18export function mockXml() { 19 const result = { 20 XmlSerializer: function (...args) { 21 console.warn("xml.XmlSerializer interface mocked in the Previewer. How this interface works on the Previewer" + 22 " may be different from that on a real device.") 23 return XmlSerializerMock; 24 }, 25 XmlPullParser: function (...args) { 26 console.warn("xml.XmlPullParser interface mocked in the Previewer. How this interface works on the Previewer" + 27 " may be different from that on a real device.") 28 return XmlPullParserMock; 29 } 30 } 31 const XmlSerializerMock = { 32 setAttributes: function (...args) { 33 console.warn("XmlSerializer.setAttributes interface mocked in the Previewer. How this interface works on the Previewer" + 34 " may be different from that on a real device.") 35 }, 36 addEmptyElement: function (...args) { 37 console.warn("XmlSerializer.addEmptyElement interface mocked in the Previewer. How this interface works on the Previewer" + 38 " may be different from that on a real device.") 39 }, 40 setDeclaration: function (...args) { 41 console.warn("XmlSerializer.setDeclaration interface mocked in the Previewer. How this interface works on the Previewer" + 42 " may be different from that on a real device.") 43 }, 44 startElement: function (...args) { 45 console.warn("XmlSerializer.startElement interface mocked in the Previewer. How this interface works on the Previewer" + 46 " may be different from that on a real device.") 47 }, 48 endElement: function (...args) { 49 console.warn("XmlSerializer.endElement interface mocked in the Previewer. How this interface works on the Previewer" + 50 " may be different from that on a real device.") 51 }, 52 setNamespace: function (...args) { 53 console.warn("XmlSerializer.setNamespace interface mocked in the Previewer. How this interface works on the Previewer" + 54 " may be different from that on a real device.") 55 }, 56 setCommnet: function (...args) { 57 console.warn("XmlSerializer.setCommnet interface mocked in the Previewer. How this interface works on the Previewer" + 58 " may be different from that on a real device.") 59 }, 60 setCData: function (...args) { 61 console.warn("XmlSerializer.setCData interface mocked in the Previewer. How this interface works on the Previewer" + 62 " may be different from that on a real device.") 63 }, 64 setText: function (...args) { 65 console.warn("XmlSerializer.setText interface mocked in the Previewer. How this interface works on the Previewer" + 66 " may be different from that on a real device.") 67 }, 68 setDocType: function (...args) { 69 console.warn("XmlSerializer.setDocType interface mocked in the Previewer. How this interface works on the Previewer" + 70 " may be different from that on a real device.") 71 } 72 } 73 const XmlPullParserMock = { 74 parse: function (...args) { 75 console.warn("XmlPullParser.parse interface mocked in the Previewer. How this interface works on the Previewer" + 76 " may be different from that on a real device.") 77 } 78 } 79 return result; 80} 81