Forum Discussion

hlalumiere's avatar
hlalumiere
Regular Contributor
13 years ago

How can I reference the XSD schema from the XML log file?

Hello,



I am currently in the process of writing a small post-process filter for unpacked TestComplete logs that will essentially strip all common files and put them in a proper common folder, and update all references to them from HTML and JS files.



I already have done that with shared GIF and Javascript files, and managed to reduce the total files size on disk by about 8%, as well as reduce the amount of files created by close to 20%. That might not seem like a lot, but when the logs for a single test machine for a single day make up around 12GB, and when you have 30 of those machines logging at the same place, it takes a LOT of time to sift through those files and clean up the old logs. Every little bit helps.



Now I am trying to split up the XSD and XML files. I have tried using the "xsi:schemaLocation" property inside the XML, but I cannot figure out how to use it with a UNC path.



For example, let`s say I have the file \\SomeServer\Path\foo.xml, and I want the XSD to be at \\SomeServer\Common\foo.xsd. What do I need to add to the xml file to make it so?



I'll be glad to share the tool with other TestComplete users around here if someone manages to help me out on this.



Hugo

  • Hi Hugo,


     


    As far as I know, it's impossible to specify the relative path to a XSD file in schemaLocation. Only the full path is possible:




    xsi:schemaLocation="file:///C:/path/foo.xsd">




     


    I can suggest you another way, you can use TestComplete's ValidateXMLbyXSD script extension - you need to pass the paths to the XML and XSD files to it, and the script validates the file. Refer to the "Validate an XML File by its XSD Scheme" article for details.