@@ -36,43 +36,50 @@ export default class Configurable implements ReadInterface {
36
36
let data = { } ;
37
37
for ( const elementName of Object . keys ( config . elements ) ) {
38
38
const elementConfig = config . elements [ elementName ] ;
39
- const xpathResult = document . evaluate (
40
- elementConfig . path ,
41
- element ,
42
- null ,
43
- XPathResult . FIRST_ORDERED_NODE_TYPE ,
44
- null ,
45
- ) ;
46
- const currentElement = xpathResult . singleNodeValue ;
47
- if ( currentElement === null || currentElement === undefined ) {
48
- continue ;
49
- }
50
- if ( elementConfig . style . length ) {
51
- data = this . readStyle (
52
- elementConfig . style ,
53
- currentElement ,
54
- data ,
55
- propertyReaderPool ,
56
- converterPool ,
57
- ) ;
58
- }
59
- if ( elementConfig . attributes . length ) {
60
- data = this . readAttributes (
61
- elementConfig . attributes ,
62
- currentElement ,
63
- data ,
64
- propertyReaderPool ,
65
- converterPool ,
39
+ // Do not read if path is optional
40
+ console . log ( elementConfig ) ;
41
+ if ( elementConfig . path !== "" ) {
42
+ console . log ( "path" ) ;
43
+ const xpathResult = document . evaluate (
44
+ elementConfig . path ,
45
+ element ,
46
+ null ,
47
+ XPathResult . FIRST_ORDERED_NODE_TYPE ,
48
+ null ,
66
49
) ;
67
- }
68
- if ( undefined !== elementConfig . html . var ) {
69
- data = this . readHtml ( elementConfig , currentElement , data , converterPool ) ;
70
- }
71
- if ( undefined !== elementConfig . tag . var ) {
72
- data = this . readHtmlTag ( elementConfig , currentElement , data ) ;
73
- }
74
- if ( undefined !== elementConfig . css . var ) {
75
- data = this . readCss ( elementConfig , currentElement , data ) ;
50
+ const currentElement = xpathResult . singleNodeValue ;
51
+ if ( currentElement === null || currentElement === undefined ) {
52
+ continue ;
53
+ }
54
+ if ( elementConfig . style . length ) {
55
+ data = this . readStyle (
56
+ elementConfig . style ,
57
+ currentElement ,
58
+ data ,
59
+ propertyReaderPool ,
60
+ converterPool ,
61
+ ) ;
62
+ }
63
+ if ( elementConfig . attributes . length ) {
64
+ data = this . readAttributes (
65
+ elementConfig . attributes ,
66
+ currentElement ,
67
+ data ,
68
+ propertyReaderPool ,
69
+ converterPool ,
70
+ ) ;
71
+ }
72
+ if ( undefined !== elementConfig . html . var ) {
73
+ data = this . readHtml ( elementConfig , currentElement , data , converterPool ) ;
74
+ }
75
+ if ( undefined !== elementConfig . tag . var ) {
76
+ data = this . readHtmlTag ( elementConfig , currentElement , data ) ;
77
+ }
78
+ if ( undefined !== elementConfig . css . var ) {
79
+ data = this . readCss ( elementConfig , currentElement , data ) ;
80
+ }
81
+ } else {
82
+ console . log ( "no path" ) ;
76
83
}
77
84
}
78
85
data = this . convertData ( config , data , massConverterPool ) ;
0 commit comments