Extract all the possible xpaths from a schema
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 3
- Joined: Mon Apr 13, 2015 12:34 am
Extract all the possible xpaths from a schema
Hi,
is there a way to extract all the possible XPaths from a schema (.xsd)?
Something like
root
root/provider
root/provider/company
root/provider/company@name
root/provider/company@address
root/recipient
root/recipient/person
root/recipient/person@name
...
These are not the XPaths which are in the schema itself. Rather all the XPaths which can occur in valid xml file, that corresponds to the schema.
Thanks in advance
is there a way to extract all the possible XPaths from a schema (.xsd)?
Something like
root
root/provider
root/provider/company
root/provider/company@name
root/provider/company@address
root/recipient
root/recipient/person
root/recipient/person@name
...
These are not the XPaths which are in the schema itself. Rather all the XPaths which can occur in valid xml file, that corresponds to the schema.
Thanks in advance
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Extract all the possible xpaths from a schema
Post by sorin_ristache »
Hi,
There is no automatic way or special action for that in the Oxygen application. I suppose you can get a list of XPath expressions of all the possible XML elements and attributes in a two step process like the following:
There is no automatic way or special action for that in the Oxygen application. I suppose you can get a list of XPath expressions of all the possible XML elements and attributes in a two step process like the following:
- generate one complete XML document from the XSD schema using the action from menu Tools -> Generate Sample XML Files; you may find this video tutorial helpful for this step;
- create and run an XSLT stylesheet on the generated XML document that goes through every element and attribute and lists to the output the XPath of that element/attribute; you may find this video tutorial and this recorded webinar helpful for this task.
Regards,
Sorin
<oXygen/> XML Editor Support
Sorin
<oXygen/> XML Editor Support
-
- Posts: 3
- Joined: Mon Apr 13, 2015 12:34 am
Re: Extract all the possible xpaths from a schema
I just got informed that this topic has been "approved by a moderator or administrator".
If this means that eventually it could be implemented in a future release, I have some more wishes in the meantime.
Instead of just the paths, I would like to have the cardinality of an element included. Something like:
root[1]
root[1]/provider[0..n]
root[1]/provider[0..n]/company[1]
root[1]/provider[0..n]/company[1]@name[req]
root[1]/provider[0..n]/company[1]@address[opt]
root[1]/recipient[1..3]
root[1]/recipient[1..3]/person[1]
root[1]/recipient[1..3]/person[1]@name[opt]
Meaning: root has minOccurs=1 and maxOccurs=1 (which is shortened to [1] instead of [1..1]). provider has minOccurs=0 and maxOccurs=unbounded etc. The Attribute @name has use=required and therefore gets a [req]. Obviously address has use=optional. In this shorthand form I would like to have the cardinalities always shown, even if they are relying on the defaults within the schema.
This would be helpful in a table with all the possible elements and attributes for discussing different aspects of the elements.
Would be nice if it's configurable whether the output is like this version or the first I presented.
Thanks in advance
andy
If this means that eventually it could be implemented in a future release, I have some more wishes in the meantime.
Instead of just the paths, I would like to have the cardinality of an element included. Something like:
root[1]
root[1]/provider[0..n]
root[1]/provider[0..n]/company[1]
root[1]/provider[0..n]/company[1]@name[req]
root[1]/provider[0..n]/company[1]@address[opt]
root[1]/recipient[1..3]
root[1]/recipient[1..3]/person[1]
root[1]/recipient[1..3]/person[1]@name[opt]
Meaning: root has minOccurs=1 and maxOccurs=1 (which is shortened to [1] instead of [1..1]). provider has minOccurs=0 and maxOccurs=unbounded etc. The Attribute @name has use=required and therefore gets a [req]. Obviously address has use=optional. In this shorthand form I would like to have the cardinalities always shown, even if they are relying on the defaults within the schema.
This would be helpful in a table with all the possible elements and attributes for discussing different aspects of the elements.
Would be nice if it's configurable whether the output is like this version or the first I presented.
Thanks in advance

andy
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Extract all the possible xpaths from a schema
Hi,
I cannot find a feature request logged for this on our issue tracking tool. I'm afraid this is not something that we are likely to implement into the application in the short term.
If I may ask, why not save a diagram from the Design view with the hierarchy of the XML structure?
Regards,
Adrian
This is a moderated forum, so the email you have received refers to your post being approved to be published on the forum. It's a bit strange that you would receive the message now, 6 months after your posted.andy wrote:I just got informed that this topic has been "approved by a moderator or administrator".
If this means that eventually it could be implemented in a future release, I have some more wishes in the meantime.
I cannot find a feature request logged for this on our issue tracking tool. I'm afraid this is not something that we are likely to implement into the application in the short term.
If I may ask, why not save a diagram from the Design view with the hierarchy of the XML structure?
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 43
- Joined: Tue Jul 26, 2016 6:31 pm
Re: Extract all the possible xpaths from a schema
The full XPATH listing would be exceptionally useful as a standard documentation item.adrian wrote:
If I may ask, why not save a diagram from the Design view with the hierarchy of the XML structure?
Regards,
Adrian
Those of us who use text based doc formats like DITA might want to import the list, make it into tables, annotate it etc. etc.
The XSLT should be very generic, right? And... shouldn't it be similar in concept to generating an instance?
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Extract all the possible xpaths from a schema
Hi,
Oxygen is a Java application, so most of the actions, operations and tools are implemented in Java. There are very few actions (XML refactoring) that are implemented with XQuery Update.
Regards,
Adrian
If you're wondering if implementing this is similar in concept to the implementation of the instance generator, it is, at least for traversing the schema. However, the instance generator from Oxygen is implemented in Java. There's no XSLT involved there, so it's not an easy rewrite, if that's what you're thinking of.The XSLT should be very generic, right? And... shouldn't it be similar in concept to generating an instance?
Oxygen is a Java application, so most of the actions, operations and tools are implemented in Java. There are very few actions (XML refactoring) that are implemented with XQuery Update.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
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