Skip to content

Commit eeaffbc

Browse files
committed
update info about new options
1 parent 0c2b489 commit eeaffbc

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

README.md

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ var options = {
6161
textNodeName : "#text",
6262
ignoreAttributes : true,
6363
ignoreNameSpace : false,
64+
allowBooleanAttributes : false,
6465
parseNodeValue : true,
6566
parseAttributeValue : false,
66-
trimValues: true
67+
trimValues: true,
68+
decodeHTMLchar: false,
6769
};
6870
if(fastXmlParser.validate(xmlData)=== true){//optional
6971
var jsonObj = fastXmlParser.parse(xmlData,options);
@@ -80,9 +82,11 @@ var jsonObj = fastXmlParser.convertToJson(tObj);
8082
* **attrNodeName**: (Valid name) Group all the attributes as properties of given name.
8183
* **ignoreAttributes** : Ignore attributes to be parsed.
8284
* **ignoreNameSpace** : Remove namespace string from tag and attribute names.
85+
* **allowBooleanAttributes** : a tag can have attributes without any value
8386
* **parseNodeValue** : Parse the value of text node to float, integer, or boolean.
8487
* **parseAttributeValue** : Parse the value of an attribute to float, integer, or boolean.
8588
* **trimValues** : trim string values of an attribute or node
89+
* **decodeHTMLchar** : decodes any named and numerical character HTML references excluding CDATA part.
8690

8791
To use from command line
8892
```bash
@@ -147,20 +151,7 @@ Installation of such libraries fails on some OS. You may require to install miss
147151
}
148152
```
149153

150-
* Updated options
151-
152-
```
153-
var defaultOptions = {
154-
attributeNamePrefix : "@_", //prefix for attributes
155-
attrNodeName: false, //Group attributes in separate node
156-
textNodeName : "#text", //Name for property which will have value of the node in case nested nodes are present, or attributes
157-
ignoreAttributes : true, //ignore attributes
158-
ignoreNameSpace : false, //ignore namespace from the name of a tag and attribute. It also removes xmlns attribute
159-
parseNodeValue : true, //convert the value of node to primitive type. E.g. "2" -> 2
160-
parseAttributeValue : false, //convert the value of attribute to primitive type. E.g. "2" -> 2
161-
trimValues: true, //Trim string values of tag and attributes
162-
};
163-
```
154+
* Updated options : check snippet aboove
164155
* Parse boolean values as well. E.g. `"true"` to `true`
165156
* You can set pasrer not to *trim* whitespaces from attribute or tag /node value.
166157
* Tag / node and attribute value is by default HTML decoded. However CDATA value will not be decoded.

0 commit comments

Comments
 (0)