Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » XML Encoding issue with namespaces
XML Encoding issue with namespaces [message #1849373] Fri, 14 January 2022 14:10 Go to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Hey, I got the following behaviour. Currently I am not sure whether this is correct or not.

These are the two relevant .ttcn files:

First, the Message which contains the header


module urn_iso_15118_2_2013_MsgDef {


import from XSD all;


import from urn_iso_15118_2_2013_MsgHeader all;


import from urn_iso_15118_2_2013_MsgBody all;


/* attributeFormDefault="unqualified" */


/* Message Structure */


type record V2G_Message
{
	MessageHeaderType header,
	BodyType body
}
with {
  variant "element";
  variant (header) "name as capitalized";
  variant (body) "name as capitalized";
};


}
with {
  encode "XML";
  variant "namespace as 'urn:iso:15118:2:2013:MsgDef'";
  variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
  variant "attributeFormQualified";
  variant "elementFormQualified";
}




Second, the header type itself


module urn_iso_15118_2_2013_MsgHeader {


import from XSD all;


import from urn_iso_15118_2_2013_MsgDataTypes all;


import from http_www_w3_org_2000_09_xmldsig all;


/* Message Header */


type record MessageHeaderType
{
	SessionIDType sessionID,
	NotificationType notification optional,
	Signature signature_ optional
}
with {
  variant (sessionID) "name as capitalized";
  variant (notification) "name as capitalized";
  variant (signature_) "name as 'Signature'";
  variant (signature_) "namespace as 'http://www.w3.org/2000/09/xmldsig#' prefix 'mmlsig'";
};


}
with {
  encode "XML";
  variant "namespace as 'urn:iso:15118:2:2013:MsgHeader'";
  variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
  variant "attributeFormQualified";
  variant "elementFormQualified";
}


Now, this is the resulting XML. Previous versions would attribute the Header tag to the MsgDef namespace, now it has the MsgHeader namespace. The element name ("Header") is only defined in the MsgDef namespace as an element of the record V2G_Message

<tq0003:V2G_Message xmlns:tq0003='urn:iso:15118:2:2013:MsgDef' xmlns:tq0002='urn:iso:15118:2:2013:MsgHeader' xmlns:tq0004='urn:iso:15118:2:2013:MsgDataTypes' xmlns:tq0001='urn:iso:15118:2:2013:MsgBody'><tq0002:Header><tq0004:SessionID>0000000000000000</tq0004:SessionID></tq0002:Header><tq0001:Body><tq0001:SessionSetupReq><tq0004:EVCCID>FEFEFEFEFEFE</tq0004:EVCCID></tq0001:SessionSetupReq></tq0001:Body></tq0003:V2G_Message>


This seems to confuse the EXI generators and parsers I'm working with.
For example EXIficient does not encode this in strict mode and produces an comparatively large bytestream in non-strict mode which in turn is not accepted by proprietary EXI parsers I'm working with.

Edit: Running it against xmllint with the following command
xmllint --schema V2G_CI_MsgDef.xsd test.xml

results in
 <?xml version="1.0"?>
<tq0003:V2G_Message xmlns:tq0003="urn:iso:15118:2:2013:MsgDef" xmlns:tq0002="urn:iso:15118:2:2013:MsgHeader" xmlns:tq0004="urn:iso:15118:2:2013:MsgDataTypes" xmlns:tq0001="urn:iso:15118:2:2013:MsgBody"><tq0002:Header><tq0004:SessionID>0000000000000000</tq0004:SessionID></tq0002:Header><tq0001:Body><tq0001:SessionSetupReq><tq0004:EVCCID>FEFEFEFEFEFE</tq0004:EVCCID></tq0001:SessionSetupReq></tq0001:Body></tq0003:V2G_Message>
test.xml:1: element Header: Schemas validity error : Element '{urn:iso:15118:2:2013:MsgHeader}Header': This element is not expected. Expected is ( {urn:iso:15118:2:2013:MsgDef}Header ).
test.xml fails to validate
 


You can find the scheme here

Looking through recent changes, this looks like it could be related.


I'm not really proficient with XML encoding subtleties, maybe anyone could lighten that up a bit?

Thank you!
Moritz

[Updated on: Fri, 14 January 2022 15:05]

Report message to a moderator

Re: XML Encoding issue with namespaces [message #1849393 is a reply to message #1849373] Mon, 17 January 2022 08:59 Go to previous messageGo to next message
Lenard Nagy is currently offline Lenard NagyFriend
Messages: 54
Registered: September 2016
Member
Hi Moritz,

We are checking the issue, will let You know the result ASAP.

Lenard Nagy
Re: XML Encoding issue with namespaces [message #1850263 is a reply to message #1849393] Wed, 23 February 2022 09:19 Go to previous messageGo to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Hey Lenard,
is there any progress with this issue?

Since I possibly have another one , I would like to check if the current one is still present in the most current version but can't since I had to downgrade in order to avoid this threads bug.

Thank you,
Moritz
Re: XML Encoding issue with namespaces [message #1851610 is a reply to message #1850263] Mon, 11 April 2022 07:20 Go to previous messageGo to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Gentle bump
Re: XML Encoding issue with namespaces [message #1852566 is a reply to message #1851610] Tue, 24 May 2022 07:07 Go to previous messageGo to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Hey Lenard,
I understand that there may currently be no resources to work on this or priorization of other tasks but can you confirm this is a bug and not a misuse by side?

Thanks, BR
Moritz
Re: XML Encoding issue with namespaces [message #1852569 is a reply to message #1852566] Tue, 24 May 2022 08:14 Go to previous messageGo to next message
Adam Knapp is currently offline Adam KnappFriend
Messages: 49
Registered: November 2020
Member
Hi Moritz,

Sorry for the late answer! This issue is not forgotten, however, I also don't have a clear view what should be the correct behavior. I tried to check what the XML standard says about it, but it was not clear (at least for me).
When we had an internal meeting about the issue you linked, we agreed that is a bug, and we changed the original behavior. We investigate what could be done with this, maybe having both behavior somehow.
Re: XML Encoding issue with namespaces [message #1852765 is a reply to message #1852569] Fri, 03 June 2022 09:35 Go to previous messageGo to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Hi Adam, thanks for the response!
From what I gather from the xmllint output and comparisons of other schemes and their usages, this seems to be indeed a bug.

The Header element in my case is simply not present in the {urn:iso:15118:2:2013:MsgHeader} namespace, but only in the {urn:iso:15118:2:2013:MsgDef} one.

I will try to find some relevant arguments online, if I get the time.


Edit:
This is the MsgDef scheme:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns="urn:iso:15118:2:2013:MsgDef" xmlns:v2gci_h="urn:iso:15118:2:2013:MsgHeader" 
xmlns:v2gci_b="urn:iso:15118:2:2013:MsgBody" targetNamespace="urn:iso:15118:2:2013:MsgDef" 
elementFormDefault="qualified" attributeFormDefault="qualified" version="15118 2.0"> 
  <!-- attributeFormDefault="unqualified" --> 
  <xs:import namespace="urn:iso:15118:2:2013:MsgHeader" schemaLocation="V2G_CI_MsgHeader.xsd"/> 
  <xs:import namespace="urn:iso:15118:2:2013:MsgBody" schemaLocation="V2G_CI_MsgBody.xsd"/> 
  <!-- Message Structure --> 
  <xs:element name="V2G_Message"> 
    <xs:complexType> 
      <xs:sequence> 
        <xs:element name="Header" type="v2gci_h:MessageHeaderType"/> 
          <xs:element name="Body" type="v2gci_b:BodyType"/> 
      </xs:sequence> 
    </xs:complexType> 
  </xs:element> 
</xs:schema>


The "Header" element which is generated by titan can only be found here!

[Updated on: Fri, 03 June 2022 09:40]

Report message to a moderator

Re: XML Encoding issue with namespaces [message #1855749 is a reply to message #1852765] Mon, 31 October 2022 19:47 Go to previous messageGo to next message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
Hey Adam,
is there an update to this? Were you able to look into it further?
Thanks,
Moritz
Re: XML Encoding issue with namespaces [message #1855812 is a reply to message #1855749] Fri, 04 November 2022 09:09 Go to previous message
Moritz Klass is currently offline Moritz KlassFriend
Messages: 22
Registered: August 2020
Junior Member
I just want to give a heads up that reverting https://gitlab.eclipse.org/eclipse/titan/titan.core/-/merge_requests/162 fixes the problem in the current 8.2 version. All XML validators I can find now accept the documents.
BR
Previous Topic:ctags for TTCN-3 / vim?
Next Topic:XER: Untagged optional union decoding
Goto Forum:
  


Current Time: Fri Apr 19 03:52:53 GMT 2024

Powered by FUDForum. Page generated in 0.01651 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top