Giter Club home page Giter Club logo

Comments (8)

simonech avatar simonech commented on May 22, 2024

from xliff2-object-model.

MaximBrain avatar MaximBrain commented on May 22, 2024

Hi,
Thanks for the quick response

  1. There is example with all xliff tree:
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-US" trgLang="sv-SE">
    <file id="SomeID">
        <group id="_system">
            <unit id="Unit1">
                <ignorable>
                    <source>3213</source>
                </ignorable>
            </unit>

In this case, we get exception with the following error message: "The element must contain one or more Segment"

  1. In "4.2.1 Tree Structure" paragraph in http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html documentation, the Standard says that "Unit can have at least one of (segment OR ignorable)"

Same you can find in 4.2.2.5 unit paragraph - "One or more segment or ignorable elements in any order."

  1. The following place throws the exception: "StandardValidator.cs file, 4186 line"

And the problem is in the same file with 4126 line: hasSegment |= container is Segment;
We can rename this variable to hadChildren and refactor code with the following example:

hadChildren = unit.Resources.Count > 0

from xliff2-object-model.

simonech avatar simonech commented on May 22, 2024

from xliff2-object-model.

simonech avatar simonech commented on May 22, 2024

@MaximBrain just double checked.
If you read carefully, there is a constraint:

A <unit> MUST contain at least one <segment> element.

http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html#unit

So, validation from this library is correct.

from xliff2-object-model.

DavidFatDavidF avatar DavidFatDavidF commented on May 22, 2024

Hi @MaximBrain, @simonech

This library, Okapi Lynx, and XLIFF Core Schematrons all correctly catch this as invalid.
http://docs.oasis-open.org/xliff/xliff-core/v2.1/xliff-core-v2.1.html#unit
http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html#unit
In general the spec first describes the grammar as expressible in W3C Schema and then gives any additional business logic constraints or requirements under Constraints or Processing Requirements (depending on whether they are static or dynamic):
Under unit it says explicitly:

Constraints
A <unit> MUST contain at least one <segment> element.

from xliff2-object-model.

simonech avatar simonech commented on May 22, 2024

Thx @DavidFatDavidF for the explanation

too bad we cannot close the issue 😄

from xliff2-object-model.

MaximBrain avatar MaximBrain commented on May 22, 2024

Hi,

Strange, documentation has different explained behavior
Anyway, thanks for the explanation
I'll close this issue

from xliff2-object-model.

simonech avatar simonech commented on May 22, 2024

from xliff2-object-model.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.