Comments (8)
from xliff2-object-model.
Hi,
Thanks for the quick response
- 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"
- 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."
- 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.
from xliff2-object-model.
@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.
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.
Thx @DavidFatDavidF for the explanation
too bad we cannot close the issue 😄
from xliff2-object-model.
Hi,
Strange, documentation has different explained behavior
Anyway, thanks for the explanation
I'll close this issue
from xliff2-object-model.
from xliff2-object-model.
Related Issues (20)
- <mrk> and <sm> elements with type="generic" should have the "translate" attribute set explicitly HOT 2
- <source> with only spaces are emptied on deserialization HOT 6
- Validator rejects <mrk> tags without the "translate" attribute HOT 5
- <data> made of spaces only is not preserved. HOT 1
- The "priority" attribute of the <note> element is not properly validated HOT 2
- The character '/' in namespace URIs is not allowed by the serializer HOT 2
- Source with HTML content HOT 3
- ViewValidations method in sample code doesn't show the actual validation problem HOT 1
- Multiple Groups with the same Id should not be allowed HOT 2
- When 2 validation errors happen, exception should contain both errors HOT 1
- nuget package HOT 7
- xml:lang attribute should be allowed on some other elements than <source> and <target> HOT 5
- Enhancement request: Have option to open the file even if is not valid and return validation errors HOT 4
- Support for .Net Standard HOT 8
- CDataTag in Note HOT 1
- Ongoing development? Next project iteration? HOT 2
- Custom namespace prefixes should be allowed for attributes from known namespaces
- This repo is missing important files
- Adding a Generic MarkedSpan element inside a Comment MarkedSpan element will change the type to "comment" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xliff2-object-model.