Options

XML Tags Get inverted

kovaidonkovaidon Member Posts: 55
Hi Experts,

I have an issue with XML tags

in correct version of XML , the tags are correct in order like below

<Header>
<Data>
<TramissID>
<CountryID>IT</CountryID>
<Pincode>08973230967</Pincode>
</TranmissID>
<ID>01269</ID>
<Code>FPR12</Code>
</Data>
</Header>

But in Some Case based on condition

the Tag are getting reversed

<Header>
<Data>
<ID>01269</ID>
<Code>FPR12</Code>
<TramissID>
<CountryID>IT</CountryID>
<Pincode>08973230967</Pincode>
</TranmissID>
</Data>
</Header>

The above reversed Tags is wrong.

it has to be in the order like correct version.

Why this happens ?
Could any one suggest?

Answers

  • Options
    vaprogvaprog Member Posts: 1,118
    What kind of manipulations do you do?
  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-10-17
    I think that if the all the tags in your XML have different names (which is the case in the examples above), and still the order of tags matters then probably your approach to get the information from that XML, or the parsing code is wrong (as opposite to the XML file structure being wrong in the 2nd example).

    Paste both xmls to some online xpath checker (I personally prefer freeformatter.com), and then try to pull out, for example, the CountriID node, using the /Header/Data/TramissID/CountryID xpath. You will get the same result in both cases (once you fix the TranmissID tag in your samples)


    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    kovaidonkovaidon Member Posts: 55
    Hi,

    The Solution for the above issue is found.

    Now in System we have Creation of Tag"TramissID" is common for both the cases(With Condition and without condition).

    The Solution is

    We need to apply Creation of Tag "TramissID" for With Condition seperate,
    Second seperately apply Creation of Tag "tramissID" for without condition.

    Before correction it was like
    <Header>
    <Data>
    Create <TramissID>
    If condition the begin
    <CountryID>IT</CountryID>
    <Pincode>08973230967</Pincode>
    </TranmissID>
    <ID>01269</ID>
    <Code>FPR12</Code>
    end
    else begin

    <CountryID>IT</CountryID>
    <Pincode>08973230967</Pincode>
    </TranmissID>
    <ID>01269</ID>
    <Code>FPR12</Code>
    End
    </Data>
    </Header>

    After correction it was like below, which will solve the Problem


    <Header>
    <Data>
    If condition the begin
    Create <TramissID>
    <CountryID>IT</CountryID>
    <Pincode>08973230967</Pincode>
    </TranmissID>
    <ID>01269</ID>
    <Code>FPR12</Code>
    end
    else begin
    Create <TramissID>
    <CountryID>IT</CountryID>
    <Pincode>08973230967</Pincode>
    </TranmissID>
    <ID>01269</ID>
    <Code>FPR12</Code>
    End
    </Data>
    </Header>

    Thank you Mr.Guzek for your kind input .



Sign In or Register to comment.