xmlToStruct in memory?
Author: i2stiller@gmx.de (istiller)
xmlToStruct
Is it possible to locate the XSD for xmlToStruct in memory?
Background: We do a full validation of a XML-stream with different given XSD files. First I extract the namespace out of the XML. Then I do a lookup in database for the XSD and dump this to disk. Now I can use xmlToStruct to validate the XML against this XSD-file
But, as we are now using concurrent processes, this dumping and using of external XSD is the source of an error Two USERVER-processes can not obtain the XSD at the same time (looks like this).
A workaround could be a postfix to the XSD filename, containing the process ID.
Best practice would be to have the XSD in memory of each process, but how to do this?
Regards Ingo
3 Comments
Local Administrator
Sh.., workaround doesn't work. As we are using two XSD files, one imported into the other one by <import .../>, I have two rename two files. And there I do have a problem. It seems to me, that UnifAce could not handle import without a schemalocation. Before I did change the XSD, the XSD looks like this
Before I did change the XSD, the XSD looks like this
Okay, A_4711.XSD will never find the B_4711.XSD. And as the name of B_xyz.XSD is not fix, I could not set "right" name So, I remove the schemaLocation for import (it's optional)
But I got an error -1504 "Schema Representation Constraint: Namespace 'B' is referenced without <import> declaration'" Sorry, there is an import ! I did check this XSD against other tools, and it looks quiet okay. So what is wrong? Or are there other workaround?
Author: istiller (i2stiller@gmx.de)
Local Administrator
Hi Ingo, The short answer is: No, at this moment you can refer to a single schema (only) by a file name or an URL (as documented in the Uniface Library). A possible workaround could be to embed the schema definitions (XSD) into the XML (instead of importing the XSD). In this case the XSD actually would be located in memory. Hope this helps. Regards, Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Not sure what's wrong here. Did you also check $procReturnContext if it contains any additional warning or errors? Anyways, I did a quick test here and xmlToStruct/validate seems to work fine when I do the stuff you describe. Here are a couple of things I've recognized:
Maybe you could provide a complete sample I could look at (i.e. test form, XML and XSD files). Hope this helps. Regards, Daniel
Author: diseli (daniel.iseli@uniface.com)