How to check for child node
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 93
- Joined: Mon Aug 08, 2022 2:32 pm
How to check for child node
Post by SmitaPatil »
Hi Team,
Suppose I have access to below entry node.
I wanted to check if leaderchar is present or not in entry anywhere.
as we don't have leaderchar as direct child of entry.
I can think of get all child nodes then child of child nodes and check if it is leaderchar or not with the existing method which I know.
But instead of verifying for all node one by one. I am wondering if we have any method in oxygen which will check if childnode is present with given name (can be present as grand child of node) in the given node.
<entry>
<para>
<paratext> check <bold><bold/>opportunity
<leader source="dtbl">
<leaderchar>with notice and an opportunity</leaderchar>
</leader> check
<leader source="dtbl">
<leaderchar>with notice and an opportunity</leaderchar>
</leader>
</paratext>
</para>
</entry>
Please let me know if you need any more details.
Thanks & Regards,
Smita
Suppose I have access to below entry node.
I wanted to check if leaderchar is present or not in entry anywhere.
as we don't have leaderchar as direct child of entry.
I can think of get all child nodes then child of child nodes and check if it is leaderchar or not with the existing method which I know.
But instead of verifying for all node one by one. I am wondering if we have any method in oxygen which will check if childnode is present with given name (can be present as grand child of node) in the given node.
<entry>
<para>
<paratext> check <bold><bold/>opportunity
<leader source="dtbl">
<leaderchar>with notice and an opportunity</leaderchar>
</leader> check
<leader source="dtbl">
<leaderchar>with notice and an opportunity</leaderchar>
</leader>
</paratext>
</para>
</entry>
Please let me know if you need any more details.
Thanks & Regards,
Smita
-
- Posts: 515
- Joined: Wed May 20, 2009 2:40 pm
Re: How to check for child node
Hello,
The method that you tried (checking the child nodes recursively) is the proper way of searching for a specific node.
Another way to do this, but only if you search inside a node from the document (not from an AuthorDocumentFragment), is to use the AuthorDocumentController.findNodesByXPath(String, AuthorNode, boolean, boolean, boolean, boolean) API (also check the other signatures for findNodesByXPath method).
Best Regards,
Mihaela
The method that you tried (checking the child nodes recursively) is the proper way of searching for a specific node.
Another way to do this, but only if you search inside a node from the document (not from an AuthorDocumentFragment), is to use the AuthorDocumentController.findNodesByXPath(String, AuthorNode, boolean, boolean, boolean, boolean) API (also check the other signatures for findNodesByXPath method).
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
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