diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md index ab33a232ca03c9b8ee139f497cd6ea0f572debc7..70d35b6cb168e6f10b847a42bdefa8fd53eb3d40 100644 --- a/en/application-dev/reference/apis/js-apis-convertxml.md +++ b/en/application-dev/reference/apis/js-apis-convertxml.md @@ -1,4 +1,4 @@ -# XML-to-JavaScript Conversion +# @ohos.convertxml (XML-to-JavaScript Conversion) The **convertxml** module provides APIs for converting XML text into JavaScript objects. @@ -36,6 +36,14 @@ Converts an XML text into a JavaScript object. | ------ | ---------------------------- | | Object | JavaScript object.| +**Error codes** + +For details about the error codes, see [Utils Error Codes](../errorcodes/errorcode-utils.md). + +| ID| Error Message| +| -------- | -------- | +| 10200002 | Invalid xml string. | + **Example** ```js @@ -46,13 +54,13 @@ let xml = ' Work' + ' Play' + ''; -let conv = new convertxml.convertToJSObject(); +let conv = new convertxml.ConvertXML() let options = {trim : false, declarationKey:"_declaration", instructionKey : "_instruction", attributesKey : "_attributes", textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", commentKey : "_comment", parentKey : "_parent", typeKey : "_type", nameKey : "_name", elementsKey : "_elements"} -let result = JSON.stringify(conv.convert(xml, options)); +let result = JSON.stringify(conv.convertToJSObject(xml, options)); console.log(result); // Output (non-compact) // {"_declaration":{"_attributes":{"version":"1.0","encoding":"utf-8"}},"_elements":[{"_type":"element","_name":"note","_attributes":{"importance":"high","logged":"true"},"_elements":[{"_type":"element","_name":"title","_elements":[{"_type":"text","_text":"Happy"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Work"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Play"}]}]}]} @@ -60,14 +68,14 @@ console.log(result); ### convert(deprecated) -> **NOTE** -> -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [convertToJSObject9+](#converttojsobject9) instead. - convert(xml: string, options?: ConvertOptions) : Object Converts an XML text into a JavaScript object. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [convertToJSObject9+](#converttojsobject9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** diff --git a/en/application-dev/reference/errorcodes/Readme-EN.md b/en/application-dev/reference/errorcodes/Readme-EN.md index baad748a3276fa43a4c891ef531fa62f11598ee3..752470eb0b26c90762b219f57d5f5b7bbc312ef1 100644 --- a/en/application-dev/reference/errorcodes/Readme-EN.md +++ b/en/application-dev/reference/errorcodes/Readme-EN.md @@ -3,9 +3,13 @@ - Ability Framework - [Ability Error Codes](errorcode-ability.md) - [Distributed Scheduler Error Codes](errorcode-DistributedSchedule.md) + - [Form Error Codes](errorcode-form.md) - Bundle Management - [Bundle Error Codes](errorcode-bundle.md) - [zlib Error Codes](errorcode-zlib.md) +- Common Event and Notification + - [Event Error Codes](errorcode-CommonEventService.md) + - [DistributedNotificationService Error Codes](errorcode-DistributedNotificationService.md) - UI Page - [promptAction Error Codes](errorcode-promptAction.md) - [Router Error Codes](errorcode-router.md) @@ -30,27 +34,38 @@ - [HUKS Error Codes](errorcode-huks.md) - Data Management - [RDB Error Codes](errorcode-data-rdb.md) + - [Distributed KV Store Error Codes](errorcode-distributedKVStore.md) - [Preferences Error Codes](errorcode-preferences.md) - Network Management - [Upload and Download Error Codes](errorcode-request.md) +- Connectivity + - [NFC Error Codes](errorcode-nfc.md) + - [RPC Error Codes](errorcode-rpc.md) - Basic Features + - [Accessibility Error Codes](errorcode-accessibility.md) - [FaultLogger Error Codes](errorcode-faultlogger.md) - [Application Event Logging Error Codes](errorcode-hiappevent.md) - [HiSysEvent Error Codes](errorcode-hisysevent.md) - [HiDebug Error Codes](errorcode-hiviewdfx-hidebug.md) - [Input Method Framework Error Codes](errorcode-inputmethod-framework.md) - [Pasteboard Error Codes](errorcode-pasteboard.md) + - [Screen Lock Management Error Codes](errorcode-screenlock.md) - [Webview Error Codes](errorcode-webview.md) - Account Management - [Account Error Codes](errorcode-account.md) - [App Account Error Codes](errorcode-app-account.md) - Device Management + - [Power Consumption Statistics Error Codes](errorcode-batteryStatistics.md) + - [Brightness Error Codes](errorcode-brightness.md) + - [Power Manager Error Codes](errorcode-power.md) + - [Running Lock Error Codes](errorcode-runninglock.md) + - [Thermal Manager Error Codes](errorcode-thermal.md) - [Device Management Error Codes](errorcode-device-manager.md) + - [Location Subsystem Error Codes](errorcode-geoLocationManager.md) - [Screen Hopping Error Codes](errorcode-multimodalinput.md) - [Sensor Error Codes](errorcode-sensor.md) - [Vibrator Error Codes](errorcode-vibrator.md) - [System Parameter Error Codes](errorcode-system-parameterV9.md) - [USB Error Codes](errorcode-usb.md) -- Language Base Class Library - - [Buffer Error Codes](errorcode-buffer.md) - - [containers Error Codes](errorcode-containers.md) +- Language Base Class Library + - [Utils Error Codes](errorcode-utils.md) diff --git a/en/application-dev/reference/errorcodes/errorcode-buffer.md b/en/application-dev/reference/errorcodes/errorcode-buffer.md deleted file mode 100644 index be671af43ec2cf9b01a27a43edb17a6fb77d87c3..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/errorcodes/errorcode-buffer.md +++ /dev/null @@ -1,55 +0,0 @@ -# Buffer Error Codes - -## 10200001 Value Out of Range - -**Error Message** - -The value of ${param} is out of range. - -**Description** - -The value of a parameter passed in the API exceeds the valid range. - -**Possible Causes** - -The parameter value exceeds the value range. - -**Solution** - -Check and modify the parameter value. - -## 10200009 Incorrect Buffer Size - -**Error Message** - -Buffer size must be a multiple of ${size} - -**Description** - -The buffer size must be an integer multiple of 16 bits, 32 bits, or 64 bits. - -**Possible Causes** - -The buffer size is not an integer multiple of 16 bits, 32 bits, or 64 bits. - -**Solution** - -Check the buffer length. - -## 10200013 Read-Only Properly - -**Error Message** - -Cannot set property ${propertyName} of Buffer which has only a getter. - -**Description** - -The buffer ${propertyName} is read-only and cannot be set. - -**Possible Causes** - -The ${propertyName} parameter is read-only and cannot be set. - -**Solution** - -${propertyName} cannot be set. Do not place it on the left of the equal sign (=). diff --git a/en/application-dev/reference/errorcodes/errorcode-containers.md b/en/application-dev/reference/errorcodes/errorcode-containers.md deleted file mode 100644 index 3290128727cce24a13bd0ecbe46ec94c0c19c3a7..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/errorcodes/errorcode-containers.md +++ /dev/null @@ -1,74 +0,0 @@ -# containers Error Codes - -## 10200012 Constructor Calling Failure - -**Error Message** - -The {className}'s constructor cannot be directly invoked. - -**Description** - -A constructor of the **containers** class is called directly to create an instance. - -**Possible Causes** - -The constructors of the **containers** class cannot be directly called. The keyword **new** must be used. - -**Solution** - -Use the keyword **new** to create an instance. - -## 10200011 Passed this object Is Not an Instance of the containers Class - -**Error Message** - -The {methodName} method cannot be bound. - -**Description** - -**this object** passed in the API is not an instance of the **containers** class. - -**Possible Causes** - -The APIs of the **containers** class do not support **bind()**. - -**Solution** - -1. Check whether **bind()** is used to call the API. -2. Check whether an object that is not a container instance is assigned to the API. - -## 10200001 Invalid Parameter Value - -**Error Message** - -The parameter value is out of range. - -**Description** - -The value of a parameter passed in the API exceeds the valid range. - -**Possible Causes** - -The parameter value is out of range. - -**Solution** - -Use a value within the range. - -## 10200010 Empty Container - -**Error Message** - -The container is empty. - -**Description** - -The container to be operated is empty. - -**Possible Causes** - -The container is empty. - -**Solution** - -Add elements to the container first. diff --git a/en/application-dev/reference/errorcodes/errorcode-form.md b/en/application-dev/reference/errorcodes/errorcode-form.md new file mode 100644 index 0000000000000000000000000000000000000000..232306b030f7ef912726a95548d4dc1efe1c8050 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-form.md @@ -0,0 +1,138 @@ +# Form Error Codes + +## 16500001 Internal Error + +**Error Message** + +Internal Error. + +**Description** + +A common kernel error, for example, a malloc failure, occurs. + +**Possible Causes** + +The memory is insufficient. + +**Solution** + +Analyze the memory usage of the entire process, and check whether memory leakage occurs. + +## 16500050 IPC Failure + +**Error Message** + +An IPC connection error happened. + +**Description** + +An error occurs when the system initiates inter-process communications (IPC) to complete the request. + +**Possible Causes** + +The parameter value passed in the API is too large, causing IPC data verification failure. + +**Solution** + +Pass appropriate parameter values. + +## 16500060 Service Connection Failure + +**Error Message** + +A service connection error happened, please try again later. + +**Description** + +An error occurs when the system attempts to connect to a service to complete the request. + +**Possible Causes** + +The service is busy or abnormal. + +**Solution** + +Try again after the service is restarted. + +## 16500100 Failed to Obtain Widget Configuration Information + +**Error Message** + +Failed to obtain configuration information. + +**Description** + +An error occurs when the system attempts to obtain widget configuration information to complete the request. + +**Possible Causes** + +The widget configuration information field is missing or invalid. + +**Solution** + +Use the correct configuration information. + +## 16501000 Functional Error + +**Error Message** + +A functional error occurred. + +**Description** + +An internal error occurs when the system executes the request. + +## 16501001 Widget ID Not Exist + +**Error Message** + +The ID of the form to be operated does not exist. + +**Description** + +The specified widget in the request is not found. + +**Possible Causes** + +The widget ID passed in the API does not exist or is invalid. + +**Solution** + +Use a valid widget ID. + +## 16501002 Too Many Widgets + +**Error Message** + +The number of forms exceeds the upper bound. + +**Description** + +The application attempts to add more widgets when the number of widgets has reached the upper limit. + +**Possible Causes** + +The number of widgets has reached the upper limit. + +**Solution** + +Delete unnecessary widgets and then add the required widgets. + +## 16501003 Widget Not Operatable + +**Error Message** + +The form can not be operated by the current application. + +**Description** + +The application cannot perform operations on a widget. + +**Possible Causes** + +The widget does not belong to the application. + +**Solution** + +1. Check the ownership of the widget ID. +2. Upgrade the application permission to **SystemApp**. diff --git a/en/application-dev/reference/errorcodes/errorcode-utils.md b/en/application-dev/reference/errorcodes/errorcode-utils.md new file mode 100644 index 0000000000000000000000000000000000000000..9bb6853ced81e314b8ad1622e0d39590145a31d7 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-utils.md @@ -0,0 +1,221 @@ +# Utils Error Codes + +## 10200001 Value Out of Range + +**Error Message** + +The value of ${param} is out of range. + +**Description** + +The value of a parameter passed in the API exceeds the valid range. + +**Possible Causes** + +The parameter value exceeds the value range. + +**Solution** + +Use a valid parameter value. + +## 10200002 Parameter Parsing Error + +**Error Message** + +Invalid ${param} string. + +**Description** + +Failed to parse a string. + +**Possible Causes** + +A parameter of the string type passed in the API is a non-standard string. As a result, the string fails to be parsed. + +**Solution** + +Check the format of the string. + +## 10200003 Failed to Initialize the Worker Instance + +**Error Message** + +Worker initialization failure. + +**Description** + +The **Worker** instance fails to be initialized when the API is called. + +**Possible Causes** + +1. The number of **Worker** instances to be created exceeds the upper limit. +2. The options for setting the **Worker** instance are incorrect. + +**Solution** + +1. Check whether the number of **Worker** instances exceeds 8. If yes, destroy idle **Worker** instances. +2. If **WorkerOptions** is set, check the parameter type and validity. + +## 10200004 Worker Instance Is Not Running + +**Error Message** + +Worker instance is not running. + +**Description** + +The **Worker** instance is not running when the API is called. + +**Possible Causes** + +When the API is called, the **Worker** instance has been destroyed or is being destroyed. + +**Solution** + +Ensure that the **Worker** instance is running properly. + +## 10200005 Worker Thread Does Not Support an API + +**Error Message** + +The invoked API is not supported in workers. + +**Description** + +An API that is not supported by the worker thread is called. + +**Possible Causes** + +The worker thread does not support the API. + +**Solution** + +Use a supported API. + +## 10200006 Worker Transmission Information Serialization Exception + +**Error Message** + +Serializing an uncaught exception failed. + +**Description** + +An error occurs when serializing transmission information. + +**Possible Causes** + +The transmission information is not serializable. + +**Solution** + +Use transmission information that is a valid serialized object. + +## 10200007 Abnormal Worker File Path + +**Error Message** + +The worker file path is invalid. + +**Description** + +The file path is invalid, and the **Worker** instance cannot be loaded. + +**Possible Causes** + +The worker file path is invalid. As a result, a valid **worker.abc** file cannot be generated during the build. + +**Solution** + +Ensure that the worker file path complies with the specifications for creating **Worker** instances. For details, see the example under [constructor9+](../apis/js-apis-worker.md#constructor9). + +## 10200009 Buffer Size Error + +**Error Message** + +Buffer size must be a multiple of ${size}. + +**Description** + +The buffer size does not meet the requirement. + +**Possible Causes** + +The buffer size is not an integer multiple of **size**, which can be 16-bit, 32-bit, or 64-bit. + +**Solution** + +Use a buffer the size of which meets the requirements. + + +## 10200010 Empty Container + +**Error Message** + +The container is empty. + +**Description** + +The container to be operated is empty. + +**Possible Causes** + +No element is added to the container. + +**Solution** + +Add elements to the container first. + +## 10200011 Passed this.object Is Not an Instance of the containers Class + +**Error Message** + +The {methodName} method cannot be bound. + +**Description** + +**this.object** passed in the API is not an instance of the **containers** class. + +**Possible Causes** + +The APIs of the **containers** class do not support **bind()**. + +**Solution** + +1. Check whether **bind()** is used to call the API. +2. Check whether an object that is not a container instance is assigned to the API. + +## 10200012 Constructor Calling Failure + +**Error Message** + +The {className}'s constructor cannot be directly invoked. + +**Description** + +A constructor of the **containers** class is called directly to create an instance. + +**Possible Causes** + +The constructors of the **containers** class cannot be directly called. The keyword **new** must be used. + +**Solution** + +Use the keyword **new** to create an instance. + +## 10200013 Read-Only Properly + +**Error Message** + +Cannot set property ${propertyName} of Buffer which has only a getter. + +**Description** + +The buffer ${propertyName} is read-only and cannot be set. + +**Possible Causes** + +The buffer is read-only. + +**Solution** + +Do not set the read-only attribute for the buffer.