bamaer commented on PR #9345:
URL: https://github.com/apache/hop/pull/9345#issuecomment-6693981106

   Thanks @hansva, nice speed-up. The XML join part looks good to me.
   
   **Blocker**
   
   **XSD validator, "no XSD needed" (location hints): rows are validated 
against a schema from an earlier row.** `XsdValidator.java:299` keeps one 
`Validator` for `data.schemaFromDocuments`. That validator keeps the schemas it 
loaded from earlier documents' `xsi:noNamespaceSchemaLocation` / 
`xsi:schemaLocation` hints. With *Allow external entities* on (in my test, 
hints only resolve with it on), the same input gives:
   
   | rows (`<order><id>…</id></order>`) | main | this PR |
   |---|---|---|
   | str.xsd `x`, int.xsd `x`, str.xsd `x` | true, false, true | true, true, 
true |
   | no hint `x`, str.xsd `x`, no hint `x` | false, true, false | false, true, 
true |
   | int.xsd `1`, str.xsd `x`, int.xsd `x`, str.xsd `y` | true, true, false, 
true | true, false, false, true |
   
   The same happens with a target namespace and `xsi:schemaLocation`. Suggested 
fix: keep the cached schema, but don't cache the validator for the hints schema:
   
   ```java
   if (schema != data.schemaFromDocuments) {
     data.validators.put(schema, xsdValidator);
   }
   ```
   
   With that change all three cases match main again, and the PR's tests still 
pass. A test for this mode would help, since the new tests cover only fixed and 
field XSDs.
   
   Verified: built core, engine and the XML plugin from the PR head. All 230 
XML plugin tests pass (checkstyle on). The table comes from a scratch test that 
runs the transform on both main and this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to