Menu

How to get the fragment structure from xsd file

Godfrey
2023-01-17
2023-01-18
  • Godfrey

    Godfrey - 2023-01-17

    Dear Daniel

     I would like to convert the XML schemas to the C file-structure with the XSD files which provided by ISO.
    
    I  can see that in OpenV2G project, there are documents and fragments structure in the EXI codes. But when I use the tools to do the convert, I found that the fragment structure is not generated.
    
    I see into the XSD file, there are no the 'fragment' field in the XSD files. But there are generated fragment structure in OpenV2G.
    
    Can you explain how to get the fragment information from the XSD file?
    
    I'm looking forward to your reply, thanks!
    
    Godfrey
    
     

    Last edit: Godfrey 2023-01-17
  • Daniel Peintner

    Daniel Peintner - 2023-01-17

    Hi,

    EXI differs between "documents" and "fragments".
    see https://www.w3.org/TR/exi/#streams

    [Definition:] EXI documents are EXI bodies with a single root element that conform to the Built-in Document Grammar (See 8.4.1 Built-in Document Grammar) or Schema-informed Document Grammar (See 8.5.1 Schema-informed Document Grammar).

    [Definition:] EXI fragments are EXI bodies with zero or more root elements that conform to the Built-in Fragment Grammar (See 8.4.2 Built-in Fragment Grammar) or Schema-informed Fragment Grammar (See 8.5.2 Schema-informed Fragment Grammar).

    Normally we use EXI documents. However, fragments are used to encode portions (for example sub-elements) that later can be signed etc.

    Hope this helps,

    -- Daniel

     
  • Godfrey

    Godfrey - 2023-01-18

    Hi Daniel
    Thank you for your reply. I take two examples in ISO15118-2 and OpenV2G code to express my puzzlement.
    1. SessionSetupReq only appear once in the xsd file, but this field exist in the document and fragment struct both.
    2. ChargingComplete appeared twice in the xsd file, this field only exist in fragment struct. I can't see the difference between this field and other fields.

    Can you give me some more help, thank you!
    Regards
    Godfrey

     
  • Daniel Peintner

    Daniel Peintner - 2023-01-18

    Hi,

    This aspect relates to the EXI specification.
    If you want to know/understand all the details I urge you to read the spec.
    see https://www.w3.org/TR/exi/

    The openV2G library is exactly about not knowing all the details and simply using the provided interfaces.

    To put it simple.
    The document grammar is about encoding valid XML/EXI documents. Not all elements are valid root elements. SessionSetupReq is a valid element while ChargingComplete is apparently not.
    The fragment grammar is the entry point for any document (valid or not valid) and hence contains all possible elements.

    I hope this helps,

    -- Daniel

     

Log in to post a comment.