Is there a way to validate external file references?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 1
- Joined: Tue Mar 05, 2024 9:14 pm
Is there a way to validate external file references?
Is there a way in Oxygen to make sure references to external files match an existing filename? For example, if I have a tag:
...I'd like Oxygen to automatically check a specified directory and see if a file named "figure6.11-1.png" actually exists; and if it doesn't, throw up a warning.
Thanks in advance for any tips.
Code: Select all
<graphic mime-subtype="png" xlink:href="figure6.11-1.png"/>
Thanks in advance for any tips.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Is there a way to validate external file references?
Hi,
You can create a Schematron schema to validate an XML document with custom validation rules.
For example if your XML document looks like this:
you could create a "test.sch" Schematron schema next to it:
In the Oxygen Preferences->"XML / XML Parser / Schematron" page there is a "Disable Schematron security checks" setting which needs to be enabled.
Then you can validate the XML document and the Schematron scheck should be applied on it.
Schematron schemas can also be associated with the XML document using validation scenarios so it is not necessary to refer directly to the Schematron inside the XML file.
Regards,
Radu
You can create a Schematron schema to validate an XML document with custom validation rules.
For example if your XML document looks like this:
Code: Select all
<?xml-model href="test.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<root>
<graphic mime-subtype="png" href="images/figure6.11-1.png"/>
</root>
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:ns uri="java:java.io.File" prefix="java-file"/>
<sch:ns uri="java:java.net.URI" prefix="java-uri"/>
<sch:pattern>
<sch:rule context="*:graphic">
<sch:assert test="java-file:exists(java-file:new(java-uri:new(resolve-uri(@href))))"> <sch:value-of select="resolve-uri(@href)"/> document should exist.</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema>
Then you can validate the XML document and the Schematron scheck should be applied on it.
Schematron schemas can also be associated with the XML document using validation scenarios so it is not necessary to refer directly to the Schematron inside the XML file.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service