Copilot commented on code in PR #3161:
URL: 
https://github.com/apache/incubator-kie-tools/pull/3161#discussion_r2113369385


##########
packages/xml-parser-ts/src/index.ts:
##########
@@ -227,7 +233,8 @@ export function parse(args: {
           : undefined); // If the current element is not known, we simply 
ignore its type and go with the defaults.
 
       // If the elemNode's meta type has a __$$text property, this is the one 
we use to parse its value.
-      // All other properties on `elemType` are certainly attributes, which 
are handlded below.
+      // All other properties (except `__$$element`) on `elemType` are 
certainly attributes, which are handlded below.

Review Comment:
   Typo in comment: `handlded` should be `handled`.
   ```suggestion
         // All other properties (except `__$$element`) on `elemType` are 
certainly attributes, which are handled below.
   ```



##########
packages/xml-parser-ts/src/index.ts:
##########
@@ -162,7 +162,7 @@ export function getParser<T extends object>(args: {
         if (k.endsWith(":") || k === "" /* Filters only `xmlns --> URL` 
mappings, since `ns` is bi-directional.*/) {
           const instanceNsKey = instanceNs.get(v)?.slice(0, -1);
           const originalXmlnsPropName = instanceNsKey ? 
`@_xmlns:${instanceNsKey}` : `@_xmlns`;
-          if (!instanceNsKey || 
!__json[args.root.element][originalXmlnsPropName]) {
+          if (instanceNsKey === undefined || 
!__json[args.root.element][originalXmlnsPropName]) {

Review Comment:
   The check for `instanceNsKey === undefined` will not catch empty strings 
(which represent the default namespace). Consider using a falsy check (`if 
(!instanceNsKey || ...)`) or explicitly checking for both `undefined` and empty 
string to ensure default namespaces are handled correctly.
   ```suggestion
             if (instanceNsKey === undefined || instanceNsKey === '' || 
!__json[args.root.element][originalXmlnsPropName]) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to