xi include part 1
This commit is contained in:
@@ -216,3 +216,29 @@ test("top-level asset ids with plain pipeline ids are not references", () => {
|
||||
0,
|
||||
);
|
||||
});
|
||||
|
||||
test("xi:include elements are outside the XSD model and unvalidated", () => {
|
||||
// The nested XInclude inside a GameObject draw list (HeadlightDraw2.xml)
|
||||
// must resolve to no XSD type, so href/xpointer can never be flagged as
|
||||
// unknown attributes.
|
||||
const xml = `
|
||||
<AssetDeclaration>
|
||||
<GameObject id="GuardianTank">
|
||||
<Draws>
|
||||
<xi:include
|
||||
href="DATA:Includes/HeadlightDraw2.xml"
|
||||
xpointer="xmlns(n=uri:ea.com:eala:asset) xpointer(/n:HeadlightDraw2/child::*)" />
|
||||
</Draws>
|
||||
</GameObject>
|
||||
</AssetDeclaration>`;
|
||||
const doc = parseXml(xml);
|
||||
const inc = doc.elements.find((e) => e.name === "xi:include");
|
||||
assert.ok(inc);
|
||||
assert.equal(model.isXsdElementName(inc.name), false);
|
||||
assert.equal(resolveElementType(inc), null);
|
||||
// The XInclude attributes themselves are unprefixed (model-valid name
|
||||
// shape); the element-level foreign check is what keeps them quiet.
|
||||
for (const a of inc.attrs) {
|
||||
assert.equal(model.isXsdAttributeName(a.name), true, a.name);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -53,6 +53,23 @@ test("Include has reference/instance/all enum", () => {
|
||||
assert.deepEqual(type?.enumValues, ["reference", "instance", "all"]);
|
||||
});
|
||||
|
||||
test("foreign namespaces are excluded from XSD validation", () => {
|
||||
// XInclude elements (xi:include / xi:fallback) come from the W3C XInclude
|
||||
// namespace, not from the EA asset XSD.
|
||||
assert.equal(model.isXsdElementName("xi:include"), false);
|
||||
assert.equal(model.isXsdElementName("xi:fallback"), false);
|
||||
assert.equal(model.isXsdElementName("GameObject"), true);
|
||||
assert.equal(model.isXsdElementName("AssetDeclaration"), true);
|
||||
// EA schema attributes are unprefixed; prefixed attributes (xai:, xi:,
|
||||
// xlink:, xml:, xsi:, xmlns:*) are namespace machinery.
|
||||
assert.equal(model.isXsdAttributeName("href"), true);
|
||||
assert.equal(model.isXsdAttributeName("xpointer"), true);
|
||||
assert.equal(model.isXsdAttributeName("xai:joinAction"), false);
|
||||
assert.equal(model.isXsdAttributeName("xlink:href"), false);
|
||||
assert.equal(model.isXsdAttributeName("xml:space"), false);
|
||||
assert.equal(model.isXsdAttributeName("xmlns:xi"), false);
|
||||
});
|
||||
|
||||
test("type assignability follows inheritance", () => {
|
||||
assert.ok(model.isAssignableTo("GameObject", "BaseInheritableAsset"));
|
||||
assert.ok(model.isAssignableTo("GameObject", "GameObject"));
|
||||
|
||||
Reference in New Issue
Block a user