Skip to content

Commit 8d6117c

Browse files
committed
fix(jest): fixed jest tests
1 parent 124f854 commit 8d6117c

File tree

5 files changed

+3401
-2264
lines changed

5 files changed

+3401
-2264
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"*.twig": "twig",
44
"ios": "cpp",
55
"vector": "cpp",
6-
"iostream": "cpp"
6+
"iostream": "cpp",
7+
"iosfwd": "cpp"
78
},
89
"C_Cpp.errorSquiggles": "disabled"
910
}

Readme.md

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
Node-LibXML
2-
==========
3-
1+
# Node-LibXML
42

53
#### For old node.js versions please use verison < 4.0.0 Already for old LTS node (4,6,8) `npm install [email protected]`;
6-
#### For new node.js versions (10,12,14) we are using n-api so please install `npm install [email protected]` (4.0.0 is not working)
74

5+
#### For new node.js versions (10,12,14,16,18,20) we are using n-api so please install `npm install [email protected]`, its compatible with arm proc too for version >= 16 (you wil notice a free memoery message when using free memory function after node >16) 🙂
86

9-
Node-Libxml is a LibXML2 Node.js Wrapper
7+
Node-Libxml is a LibXML2 Node.js Wrapper
108

11-
It can perform:
9+
It can perform:
1210

1311
- Wellformed check & rerror report
14-
- Validity against DTD/XSD(Schema) check,
12+
- Validity against DTD/XSD(Schema) check,
1513
- Get doctype informations (about dtd)
1614
- GetXpath Values
1715
- Load XMl from string or file path
1816

19-
## Requirements:
17+
## Requirements:
2018

2119
Node-Libxml has nos any dependencies, it's fully bundled, so you can just use it as it comes :)
2220

23-
Works on : Linux, Osx & Windows (no 32bits, **just 64 bits**)
24-
## Why use it
21+
Works on : Linux, Osx & Windows (no 32bits, **just 64 bits**)
22+
23+
## Why use it
24+
2525
Node-libxml has been thought differently than [libxmljs](https://github.com/libxmljs/libxmljs); whereas libxmljs can be use in commun uses, you can use node-libxml if:
26+
2627
- You wan to validate against DTD (libxmljs can't)
2728
- You want a silent program if xml is not wellformed (node-libxml returns wellformed error in object; libxmljs throws)
2829
- You want to do xml processing in parallel forks
2930
- You want to load XML from file path OR string
3031
- You want to validate against DTD / schema on multiple documents with just ONE dtd/schema loaded in memory (libxmljs loads it on each validation request), so it's clearly by far fastest!
3132

32-
3333
## Install
3434

3535
```bash
@@ -62,110 +62,108 @@ Node-libxml has been thought differently than [libxmljs](https://github.com/libx
6262
//... & all xpath could do I think
6363
```
6464

65-
check [tests](./test/libxml-test.js) for more examples
66-
65+
check [tests](./test/libxml-test.js) for more examples
6766

6867
## API
6968

70-
7169
### Loading functions
7270

73-
74-
7571
##### loadXml(string)
72+
7673
A function of libxml to load the XML file
7774
`TAKE a path & RETURN true if wellformed | false if not`
7875
`SET a an array 'wellformedErrors' in libxml element containing wellformed errors`
7976

8077
##### loadXmlFromString(string)
78+
8179
A function of libxml to create the xml Dom from a string
8280
`TAKE a string containing xml & RETURN true if wellformed | false if not`
8381
`SET a an array 'wellformedErrors' in libxml element containing wellformed errors`
8482

85-
8683
##### loadDtds(array)
84+
8785
A function of libxml to load the DTDs files
8886
`TAKE an array of path of & RETURN nothing`
8987
`SET a an array 'dtdsLoadedErrors' in libxml element IF error happend on loading dtd(s)`
9088

91-
9289
##### loadSchemas(array)
90+
9391
A function of libxml to load the XSDs files
9492
`TAKE an array of path of & RETURN nothing`
9593
`SET a an array 'schemasLoadedErrors' in libxml element IF error happend on loading xsd(s)`
9694
[ex](./test/libxml-test.js#L157)
9795

98-
9996
### Validating functions
10097

101-
10298
##### validateAgainstDtd()
99+
103100
A function of libxml to validate against the previously loaded DTD(s)
104101
`TAKE nothing & RETURN a string which is the name of the first dtd which has validated`
105102
`RETURN false if no dtd(s) have validate the xml`
106103
`RETURN null if no any dtd have been corectly loaded`
107104
`SET a an array 'validationDtdErrors' in libxml element if no dtd has validate`
108105

109106
##### validateAgainstSchemas()
107+
110108
A function of libxml to validate against the previously loaded DTD(s)
111109
`TAKE nothing & RETURN a string which is the name of the first dtd which has validated`
112110
`RETURN false if no dtd(s) have validate the xml`
113111
`RETURN null if no any schema have been corectly loaded`
114112
`SET a an array 'validationDtdErrors' in libxml element if no dtd has validate`
115113

116-
117114
### Get informations of the the XML
118115

119-
120116
#### getDtd()
117+
121118
A function of libxml to evaluate the xpath on the previously loaded XML
122119
`TAKE nothin & RETURN an object containing name,externalId & systemId`
123120

124-
125121
#### xpathSelect(string)
122+
126123
A function of libxml to evaluate the xpath on the previously loaded XML
127124
`TAKE string & RETURN value depending on what you asked (number, boolean..)`
128125
`RETURN null if no match`
129126
[ex](./test/libxml-test.js#L69)
130127

131-
132128
### Memory management
129+
133130
Use those functions when you have finished jobs of elements, or before overwrite them.
134131
[ex](./test/libxml-test.js#100)
135132

136-
137133
##### freeXml()
134+
138135
A function of libxml to free XML memory file
139136
`TAKE nothing & RETURN nothin`
140137
`FREE memory & clear 'wellformedErrors' property on libxml instance`
141138

142-
143139
##### freeDtds()
140+
144141
A function of libxml to free all the DTD in memory
145142
`TAKE nothing & RETURN nothin`
146143
`FREE memory & clear 'dtdsLoadedErrors' property on libxml instance`
147144
`FREE memory & clear 'validationDtdErrors' property on libxml instance`
148145

149-
150146
##### freeSchemas()
147+
151148
A function of libxml to free all the Schema in memory
152149
`TAKE nothing & RETURN nothin`
153150
`FREE memory & clear 'schemasLoadedErrors' property on libxml instance`
154151
`FREE memory & clear 'validationSchemaErrors' property on libxml instance`
155152

156-
157153
##### clearAll()
154+
158155
A function of libxml to free all the memory taken by libxml2
159156
`TAKE nothing & RETURN nothin`
160157
free all memory in all instance in all fork using by libxml.
161158

162-
163159
## Contribute
164160

165161
### Install
162+
166163
- `npm i`
167-
- then move the build-tmp-napi-*{anyversionyougot} as -> `mv build-tmp-napi-v7 build` __(for the moment I did not found how to build directly to buiuld forlder with pre-gyp for n-api)__
168164
- `npm test` should pass 😎
165+
- `npm run publish`
169166

170167
## Important notes
168+
171169
Travis & appveyor cannot be used anymore with n-api because auto-publish from node-pre-gyp-github not working anymore + we have now n release for one node version

0 commit comments

Comments
 (0)