[oXygen-user] Associating and validating with xsd
George Cristian Bina
Wed Jan 5 09:16:23 CST 2005
Hi Mark,
> The receiver of my .xml-files wants the schemaLocation in the form
>
> xsi:schemaLocation="http://www.xmlData.ch/xmlInvoice/XSD
> schemafile.xsd"
>
> If I associate the .xsd-file without the filepath, I cannot validate it.
If you specify the schema this way then the parser will look for the
schema file in the same directory as the XML file.
The best way to work is to have the schema in some location like
http://www.xmlData.ch/xmlInvoice/XSD/schemafile.xsd and use that in your
documents. Then set up an XML Catalog to resolve the
http://www.xmlData.ch/xmlInvoice/XSD/schemafile.xsd location to a local
copy of that schema.
The batch validation sets the schema externally, that is why it is not
needed to have the schema in the file.
There is no batch schema association action.
You can use a stylesheet to append the xsi:schemaLocation attribute to
the root element of any document, something like below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:copy>
<xsl:attribute
name="xsi:schemaLocation">http://www.xmlData.ch/xmlInvoice/XSD
http://www.xmlData.ch/xmlInvoice/XSD/schemafile.xsd</xsl:attribute>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Mark Peyer wrote:
> Hi,
>
> I am exporting data out of FileMaker Pro's XML function, converting them
> with XSL to comply with an .xsd-file. I can associate the .xsd, and Oxygen 5
> will insert
> xsi:schemaLocation="http://www.xmlData.ch/xmlInvoice/XSD
> filepath/schemafile.xsd"
> Then I can validate the .xml-file.
>
> The receiver of my .xml-files wants the schemaLocation in the form
>
> xsi:schemaLocation="http://www.xmlData.ch/xmlInvoice/XSD
> schemafile.xsd"
>
> If I associate the .xsd-file without the filepath, I cannot validate it.
>
>
> In Project mode, I can validate one or all .xml-files using "Validate
> selection with...". Here validation functions with or without filepath, but
> the line
>
> xsi:schemaLocation="http://www.xmlData.ch/xmlInvoice/XSD
> schemafile.xsd"
>
> Is not inserted.
>
> As far as I can see, there is no possibility to batch associate a schema
> file.
>
> Are there any workarounds? Am I missing something?
>
> Thanks for your help.
>
More information about the oXygen-user
mailing list