Validate part of XML file
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 5
- Joined: Fri Sep 22, 2017 11:34 am
Validate part of XML file
Hello.
This seems to me a noob question, but I cannot find the answer after looking around a bit so sorry if it's obvious.
I have a few XML files that need to be validated and I only have a XSD for the core element of the files. The files also have a header section that wraps the core element.
Is there a way to create a validation scenario that ignores the header and only validates the core element, maybe using XPath?
This seems to me a noob question, but I cannot find the answer after looking around a bit so sorry if it's obvious.
I have a few XML files that need to be validated and I only have a XSD for the core element of the files. The files also have a header section that wraps the core element.
Is there a way to create a validation scenario that ignores the header and only validates the core element, maybe using XPath?
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Validate part of XML file
Hello,
No, you cannot use validation scenario to ignore the header element, and associate the XSD schema only with the core element. Probably you can do this from the XSD schema. Maybe you can use a different namespace for the header element, and associate the schema only for that namespace.
Best Regards,
Octavian
No, you cannot use validation scenario to ignore the header element, and associate the XSD schema only with the core element. Probably you can do this from the XSD schema. Maybe you can use a different namespace for the header element, and associate the schema only for that namespace.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 5
- Joined: Fri Sep 22, 2017 11:34 am
Re: Validate part of XML file
Thank you.
They DO have different namespaces so that led me to another approach that I now remember having used earlier on another project.
I've set up a validation scenario with the XSD for the core of the file and set up a catalog to specify the path to the header file, but Oxygen still fails to validate the header part, it cannot locate the elements.
Do I need to do anything else to load the files linked in the catalog?
Is it possible to see a list of the files that Oxygen has loaded during validation and also if there were any errors during load?
They DO have different namespaces so that led me to another approach that I now remember having used earlier on another project.
I've set up a validation scenario with the XSD for the core of the file and set up a catalog to specify the path to the header file, but Oxygen still fails to validate the header part, it cannot locate the elements.
Do I need to do anything else to load the files linked in the catalog?
Is it possible to see a list of the files that Oxygen has loaded during validation and also if there were any errors during load?
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Validate part of XML file
Hello,
If you do not have an XSD schema for the header, and you want to validate only the core part, I recommend you to use an NVDL schema.
I think you can create a schema something like this:
This specifies that the elements from the "http://testCore" namespace will be validated with the coreSchema.xsd, and the elements from other namespaces are allowed.
Then you can associate the NVDL schema in the XML document or use a validation scenario.
Best Regards,
Octavian
If you do not have an XSD schema for the header, and you want to validate only the core part, I recommend you to use an NVDL schema.
I think you can create a schema something like this:
Code: Select all
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0">
<namespace ns="http://testCore">
<validate schema="coreSchema.xsd"/>
</namespace>
<anyNamespace>
<allow></allow>
</anyNamespace>
</rules>
Then you can associate the NVDL schema in the XML document or use a validation scenario.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
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