Skip to content

Import common encodings #624

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Cacowned opened this issue Jan 10, 2019 · 7 comments
Closed

Import common encodings #624

Cacowned opened this issue Jan 10, 2019 · 7 comments

Comments

@Cacowned
Copy link

Cacowned commented Jan 10, 2019

In the FIX SBE Standard 1.0 it is suggested to use imports for common encodings. (see: https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/blob/master/v1-0-STANDARD/doc/04MessageSchema.md#importing-encodings)

Issue #556 was closed with the reason that it is not possible to use both imports and schema validation with a link to a StackOverflow question. In that same SO question it is also stated that the imports should be handled before validation, so it should be possible.

Can I ask why it is not possible for the SBE-tool to support this? I would rather have the tool that does the processing do all of the processing, instead of requiring yet another tool to do the pre-processing.

@mjpt777
Copy link
Contributor

mjpt777 commented Jan 10, 2019

Can you provide an example of how to do an include before validation?

@mjpt777
Copy link
Contributor

mjpt777 commented Jan 11, 2019

I've pushed a change for this and it was way more than a trivial change. Namespace handling with XInclude is a can of worms. Those references did not come even close to providing a sample of what was involved.

@mjpt777
Copy link
Contributor

mjpt777 commented Jan 11, 2019

@billsegall Can you check that the samples work OK from your perspective?

@billsegall
Copy link
Contributor

Is there way to set the path for the includes?

$ gradlew generategolangcodecs

> Configure project :
Skipping Rust integration test due to absent cargo command or sbe.skipRust property

> Task :generateGolangCodecsWithXSD FAILED
WARNING: at <#document><sbe:messageSchema>"blockLength" should be UINT16
[Warning] :10:60: Include operation failed, reverting to fallback. Resource error reading file as XML (href='src/main/resources/common-types.xml'). Reason: /home/bill/work/SBE/simple-binary-encoding/src/main/resources/common-types.xml (No such file or directory)
[Warning] :12:99: Include operation failed, reverting to fallback. Resource error reading file as XML (href='../../../../../../sbe-samples/src/main/resources/common-types.xml'). Reason: /../sbe-samples/src/main/resources/common-types.xml (No such file or directory)
[Fatal Error] :12:99: An include with href '../../../../../../sbe-samples/src/main/resources/common-types.xml'failed, and no fallback element was found.
Exception in thread "main" org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 99; An include with href '../../../../../../sbe-samples/src/main/resources/common-types.xml'failed, and no fallback element was found.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
        at uk.co.real_logic.sbe.xml.XmlSchemaParser.validate(XmlSchemaParser.java:93)
        at uk.co.real_logic.sbe.SbeTool.validateAgainstSchema(SbeTool.java:263)
        at uk.co.real_logic.sbe.SbeTool.main(SbeTool.java:202)

mjpt777 added a commit that referenced this issue Jan 12, 2019
…se include so that the path is relative to the running process. Issue #624.
@mjpt777
Copy link
Contributor

mjpt777 commented Jan 12, 2019

@billsegall The include path is relative to where the parser runs and that seems to be the only way XInclude works. I've updated the Java and C++ samples to reflect this by changing the working directory.

mjpt777 added a commit that referenced this issue Jan 14, 2019
@mjpt777
Copy link
Contributor

mjpt777 commented Jan 14, 2019

@billsegall Do things work correctly for you now?

@mjpt777 mjpt777 closed this as completed Jan 15, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants