XPath In-scope schema definitions
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 53
- Joined: Tue Aug 23, 2005 12:00 pm
XPath In-scope schema definitions
Is there a way of importing schemas into the static context of the XPath console? I know XPath itself has no syntax for importing schema's into the static context, but probbaly the API of your XPath processor implementation has (?). It would simplify my XPath expressions to specify if an Author operation should be available for the current node.
tx.,
tx.,
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XPath In-scope schema definitions
Post by sorin_ristache »
Hello,
In the Author operation that you write you can find out the current node, that is the node with the cursor in the Author editor. The AuthorAccess parameter of the Author operation has a method getCaretOffset and a method getDocumentController. You can find the current node with the code:
You also know the schema of the edited document because you set up your Author operation in a document type created from menu Options -> Preferences -> Document Type Association where you can set what schema you want for your document type.
Regards,
Sorin
In the Author operation that you write you can find out the current node, that is the node with the cursor in the Author editor. The AuthorAccess parameter of the Author operation has a method getCaretOffset and a method getDocumentController. You can find the current node with the code:
Code: Select all
authorAccess.getDocumentController().getNodeAtOffset(authorAccess.getCaretOffset())
Regards,
Sorin
-
- Posts: 53
- Joined: Tue Aug 23, 2005 12:00 pm
Re: XPath In-scope schema definitions
Sorin,
Thanks i was aware of this (and this is how i have been developing a couple of operations). What i was referring to was the XPath expression you can define when defining the action in the document type settings. Some plugins can work on various elements, as long as they of a certain type.
This is probably the kind of XPath expression you would like to have here anyway as these operations operate on a type of element, not so much the name of the element.
For example like:
If within the author operation code you could check the type (as in schema type) of the current node that would also do the trick.
The alternative is to have a long Xpath expression or a long if statement checking all possible element names of that type. This also gives a maintainance headache when new elements of the same type are introduced.
tx.,
Thanks i was aware of this (and this is how i have been developing a couple of operations). What i was referring to was the XPath expression you can define when defining the action in the document type settings. Some plugins can work on various elements, as long as they of a certain type.
This is probably the kind of XPath expression you would like to have here anyway as these operations operate on a type of element, not so much the name of the element.
For example like:
Code: Select all
self::element(*,foo:myType)
The alternative is to have a long Xpath expression or a long if statement checking all possible element names of that type. This also gives a maintainance headache when new elements of the same type are introduced.
tx.,
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: XPath In-scope schema definitions
Post by sorin_ristache »
Now I understand. No, the XPath expression that defines when the Author action can be called is not schema aware. We will consider that for a future version of Author.
Regards,
Sorin
Regards,
Sorin
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