Skip to content

Commit 14f0230

Browse files
committed
improve cfproperty examples
1 parent 7b7c177 commit 14f0230

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

docs/03.reference/01.functions/htmlparse/function.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ title: HtmlParse
33
id: function-htmlparse
44
related:
55
- function-xmlparse
6+
- function-xmlsearch
67
categories:
7-
- parsing
88
- HTML
9+
- parsing
910
---
1011

1112
parse the given HTML (not only XHTML) as XML Object, work similar to [[function-xmlParse]], but this function is very forgiving with the syntax.
13+
14+
You can then use [[function-xmlsearch]] to query to xml object

docs/03.reference/02.tags/property/_examples.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,31 @@
77
### Serializing a CFC's properties to JSON
88

99
```luceescript+trycf
10-
myCfc = new component {
10+
myCfc = new component accessors="true"{
1111
property name="foo" type="string";
1212
property name="bar" type="numeric";
13+
// NOTE: nulls are skipped when serializing
14+
property name="unset" type="numeric";
1315
foo = "hello";
1416
bar = 42;
1517
};
1618
dump(myCfc); // See CFC object with properties
1719
jsonString = serializeJson(var=myCfc, compact=false);
1820
writeOutput(jsonString); // Output: {"foo":"hello","bar":42}
1921
```
22+
23+
### Improve type handling and defaults with Lucee 7
24+
25+
```luceescript+trycf
26+
myCfc = new component accessors="true" {
27+
property name="foo" type="string";
28+
property name="bar" type="numeric";
29+
property name="arr" type="numeric" default="#[1,2,3]#";
30+
property name="st" type="numeric" default="#{lucee:"rocks"}#";
31+
foo = "hello";
32+
bar = 42;
33+
};
34+
dump(myCfc); // See CFC object with properties
35+
jsonString = serializeJson(var=myCfc, compact=false);
36+
writeOutput(jsonString); // Output: {"foo":"hello","bar":42}
37+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lucee 7 preserves property types and supports complex defaults [LDEV-801](https://luceeserver.atlassian.net/browse/LDEV-801)

0 commit comments

Comments
 (0)