metafacture-core icon indicating copy to clipboard operation
metafacture-core copied to clipboard

Make namespace check for decode-xml optional

Open TobiasNx opened this issue 1 year ago • 4 comments

https://metafacture.org/playground/?flux=inputFile%0A%7C+open-file%0A%7Cdecode-xml%0A%7Chandle-generic-xml%0A%7Cencode-yaml%0A%7Cprint%0A%3B&data=%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Crecord%3E%0A++++%3Cmets%3Afield%3Ea%3C/mets%3Afield%3E%0A++++%3Cfield%3Eb%3C/field%3E%0A%3C/record%3E

When reading a xml with namespaces but no corresponding namespace definition MF breaks. This should be optional.

TobiasNx avatar Jun 24 '24 14:06 TobiasNx

Why do you think this is a bug? The problem relies in the using of a namespace without defining one. I.e. the error lies in the input data.

dr0i avatar Jun 24 '24 14:06 dr0i

Why do you think this is a bug? The problem relies in the using of a namespace without defining one. I.e. the error lies in the input data.

You are right, but you cannot handle this data at all with MF. I would not say this is a bug, but to make this optional would be a feature. This would be similar to the option ignoreId from handle-marcxml

TobiasNx avatar Jun 24 '24 15:06 TobiasNx

There is always a way - until it isn't. Could you not filter the whole input first (treat it as a string) and use a regex that would remove the erroneous namespace?

dr0i avatar Jun 25 '24 06:06 dr0i

This is a way: https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-records%0A%7Cmatch%28pattern%3D%22mets%3A%22%2C+replacement%3D%22%22%29%0A%7Cread-string%0A%7Cdecode-xml%0A%7Chandle-generic-xml%0A%7Cencode-yaml%0A%7Cprint%0A%3B&data=%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Crecord%3E%0A++++%3Cmets%3Afield%3Ea%3C/mets%3Afield%3E%0A++++%3Cfield%3Eb%3C/field%3E%0A%3C/record%3E

dr0i avatar Aug 26 '24 12:08 dr0i

Won't fix . Use workaround like shown in https://github.com/metafacture/metafacture-core/issues/545#issuecomment-2310083714.

dr0i avatar Mar 31 '25 09:03 dr0i