Removing attribute tag from xml file

KisuKisu Member Posts: 381
I noticed a problem with importing xml files.
I'm working on a port that imports Finvoice invoice in but on its first tag (in version 1.3) it has schema and namespace attributes after Finvoice tag.

Nav xml port gives me an error with attribute tag named with those colon marks. Would there be any workaround how to get those attributes working with the port or do I have to remove them beforehand?

<Finvoice Version="1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation="Finvoice.xsd">

I used xmldom with other port I made, it has some code that removes a tag but only the first one.
If similar way around could be used to remove these 2 attributes that'd solve the problem but I'm not sure how to select the xmlns:xsi and xsi:nonamespaceschemalocation with the xmldom automation and remove them.

If I delete the finvoice tag, pretty much whole invoice is deleted from the xml file.

Anyone come accross with this kind of problem?
K.S.

Comments

  • ara3nara3n Member Posts: 9,256
    search the forum for remove namespace. There is a function that removes all the namespace from an xml file.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • KisuKisu Member Posts: 381
    I got it to remove the attribute tags but now it announces that namespace 'http://www.w3.org/2001/XMLSchema-instance' is not declared in the Object.

    Otherwise it does the trick now.

    I have ... '<xsl:template match="@*&quot; />' + ...
    for removing the tags.

    But why does it say that its not declared and which object is it pointing? the xml port or the form I'm calling the removenamespace function?

    the namespace I typed above is on the xmlns:xsi attribute ="http://...&quot; value
    K.S.
  • KisuKisu Member Posts: 381
    I tried other way and it turned out like this:

    from xml
    <Finvoice Version="1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation="Finvoice.xsd">

    to new xml
    <Finvoice Version="1.3" noNamespaceSchemaLocation="Finvoice.xsd">

    And still gives same error that that namespace xmlschema-instance url is not defined. :-k
    K.S.
Sign In or Register to comment.