@@ -181,7 +181,7 @@ export function nsdToJson(
181181
182182 const doc74 = nsds && nsds [ "74" ] ? nsds [ "74" ] : defaultDoc74 ;
183183 const doc7420 = nsds && nsds [ "7420" ] ? nsds [ "7420" ] : defaultDoc7420 ;
184-
184+
185185 function getServiceConstructedAttributes (
186186 serviceDataAttribute : Element ,
187187 ) : Element [ ] {
@@ -197,7 +197,7 @@ export function nsdToJson(
197197 ) ;
198198 }
199199
200- function getServiceDataAttributesType ( type : string | null ) : Element [ ] {
200+ function getServiceDataAttributesType ( type : string | null ) : Element [ ] {
201201 const doc81 = nsds && nsds [ "81" ] ? nsds [ "81" ] : defaultDoc81 ;
202202
203203 return Array . from (
@@ -209,7 +209,7 @@ export function nsdToJson(
209209
210210 function getServiceDataAttributes ( dataObject : Element ) : Element [ ] {
211211 const type = dataObject . getAttribute ( "type" ) ;
212-
212+
213213 return getServiceDataAttributesType ( type ) ;
214214 }
215215
@@ -236,7 +236,7 @@ export function nsdToJson(
236236 return getSubDataAttributesType ( type )
237237 }
238238
239- function getDataAttributesType ( type :string | null ) : Element [ ] {
239+ function getDataAttributesType ( type : string | null ) : Element [ ] {
240240 const doc73 = nsds && nsds [ "73" ] ? nsds [ "73" ] : defaultDoc73 ;
241241
242242 if (
@@ -535,16 +535,24 @@ export function nsdToJson(
535535 return data ;
536536 }
537537
538+ function dataObjectName ( dataObject : Element ) : string {
539+ const multiInstances = [ 'Omulti' , 'Mmulti' ]
540+ const instance = multiInstances . includes ( dataObject . getAttribute ( "presCond" ) ! ) ? '1' : '' ;
541+ const name = dataObject . getAttribute ( "name" ) ! ;
542+ return `${ name } ${ instance } ` ;
543+ }
544+
538545 function nsdDataObject ( dataObject : Element ) : CdcDescription {
539- const [ name , type , descID , presCond , dsPresCond , transient ] = [
540- "name" ,
546+ const [ type , descID , presCond , dsPresCond , transient ] = [
541547 "type" ,
542548 "descID" ,
543549 "presCond" ,
544550 "dsPresCond" ,
545551 "transient" ,
546552 ] . map ( ( attr ) => dataObject . getAttribute ( attr ) ! ) ;
547553
554+ const name = dataObjectName ( dataObject ) ; // adopt when presCond is Omulti
555+
548556 const tagName = dataObject . tagName ;
549557
550558 const presCondArgsID =
@@ -648,7 +656,7 @@ export function nsdToJson(
648656 }
649657
650658 if ( lnClassOrCdc === undefined ) return ;
651- else if ( isSupportedCdc ( lnClassOrCdc ) )
659+ else if ( isSupportedCdc ( lnClassOrCdc ) )
652660 return CdcChildren ( lnClassOrCdc ) ;
653661 else {
654662 const nsdLnClass74 = doc74 . querySelector ( `LNClass[name="${ lnClassOrCdc } "]` ) ;
@@ -659,11 +667,11 @@ export function nsdToJson(
659667
660668 const lnClassJson : LNodeDescription = { } ;
661669 getDataObjects ( nsdLnClass ) . forEach ( ( dataObject ) => {
662- const name = dataObject . getAttribute ( "name" ) ! ;
663-
670+ const name = dataObjectName ( dataObject ) ;
671+
664672 lnClassJson [ name ] = nsdDataObject ( dataObject ) ;
665673 } ) ;
666674
667675 return lnClassJson
668- }
676+ }
669677}
0 commit comments