File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as _ from "lodash";
3
3
import * as spring from "../xmlns/www.springframework.org/schema/beans" ;
4
4
import { ConfigParseError } from "./ConfigParseError" ;
5
5
import * as model from "./model" ;
6
- import { parseXmlString } from "./utils" ;
6
+ import { makeIdentifier , parseXmlString } from "./utils" ;
7
7
8
8
export default async function parseSpringXmlConfigFile ( fileNames : string [ ] ) {
9
9
// Avoid loading a file more than once or getting into a cyclic dependency loop
@@ -138,9 +138,11 @@ function flattenAttributes(obj: any) {
138
138
// Now deal with $, which contains all the attributes
139
139
if ( obj . $ ) {
140
140
for ( const key in obj . $ ) {
141
- if ( obj . $ . hasOwnProperty ( key ) )
141
+ if ( obj . $ . hasOwnProperty ( key ) ) {
142
142
// Add the attributes as direct children of the object
143
- result [ key ] = obj . $ [ key ] ;
143
+ // If the name contains a hyphen, turn it into a valid identifier
144
+ result [ makeIdentifier ( key ) ] = obj . $ [ key ] ;
145
+ }
144
146
}
145
147
}
146
148
return result ;
You can’t perform that action at this time.
0 commit comments