@xapi-js/core 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -28
- package/dist/index.cjs +764 -747
- package/dist/index.d.cts +237 -233
- package/dist/index.d.ts +237 -233
- package/dist/index.js +724 -695
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -40,13 +40,9 @@ const xmlString = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
40
40
|
</Parameters>
|
|
41
41
|
</Root>`;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.log('Method:', xapi.getParameter('method')?.value);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
parseXapi();
|
|
43
|
+
const xapi = parse(xmlString);
|
|
44
|
+
console.log('Service:', xapi.getParameter('service')?.value);
|
|
45
|
+
console.log('Method:', xapi.getParameter('method')?.value);
|
|
50
46
|
```
|
|
51
47
|
|
|
52
48
|
### Creating and Manipulating XapiRoot
|
|
@@ -85,7 +81,7 @@ console.log('XapiRoot created:', xapi);
|
|
|
85
81
|
You can serialize an `XapiRoot` object back into an X-API XML string:
|
|
86
82
|
|
|
87
83
|
```typescript
|
|
88
|
-
import {
|
|
84
|
+
import { write, XapiRoot, Dataset } from '@xapi-ts/core';
|
|
89
85
|
|
|
90
86
|
const xapi = new XapiRoot();
|
|
91
87
|
xapi.addParameter({ id: 'status', value: 'OK' });
|
|
@@ -98,13 +94,8 @@ productsDataset.setColumn(0, 'productId', 'P001');
|
|
|
98
94
|
productsDataset.setColumn(0, 'price', 1000);
|
|
99
95
|
xapi.addDataset(productsDataset);
|
|
100
96
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
console.log('생성된 XML:
|
|
104
|
-
', xmlOutput);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
writeXapi();
|
|
97
|
+
const xmlOutput = write(xapi);
|
|
98
|
+
console.log('Generated XML:\n', xmlOutput);
|
|
108
99
|
```
|
|
109
100
|
|
|
110
101
|
---
|
|
@@ -151,13 +142,9 @@ const xmlString = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
151
142
|
</Parameters>
|
|
152
143
|
</Root>`;
|
|
153
144
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
console.log('메서드:', xapi.getParameter('method')?.value);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
parseXapi();
|
|
145
|
+
const xapi = parse(xmlString);
|
|
146
|
+
console.log('서비스:', xapi.getParameter('service')?.value);
|
|
147
|
+
console.log('메서드:', xapi.getParameter('method')?.value);
|
|
161
148
|
```
|
|
162
149
|
|
|
163
150
|
### XapiRoot 생성 및 조작
|
|
@@ -209,10 +196,6 @@ productsDataset.setColumn(0, 'productId', 'P001');
|
|
|
209
196
|
productsDataset.setColumn(0, 'price', 1000);
|
|
210
197
|
xapi.addDataset(productsDataset);
|
|
211
198
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
console.log('생성된 XML:\n', xmlOutput);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
writeXapi();
|
|
199
|
+
const xmlOutput = write(xapi);
|
|
200
|
+
console.log('생성된 XML:\n', xmlOutput);
|
|
218
201
|
```
|