find all node value after the current node for a specific node
Having trouble installing Oxygen? Got a bug to report? Post it all here.
			- 
				SmitaraniB
 - Posts: 3
 - Joined: Tue Nov 29, 2022 1:44 pm
 
find all node value after the current node for a specific node
Post by SmitaraniB »
Hi Team,
I wanted to check if we can get all the node value after the selected node in the sequence they are present to a variable.
Thanks,
Smita
			
			
						I wanted to check if we can get all the node value after the selected node in the sequence they are present to a variable.
Capture_pdc.PNG
in the attachment I am at the selected pdc.number element tag with value 34 and I want all the values in the pdc element tag value sequentially using js file.Thanks,
Smita
You do not have the required permissions to view the files attached to this post.
			
									
						- 
				cristi_talau
 - Posts: 517
 - Joined: Thu Sep 04, 2014 4:22 pm
 
Re: find all node value after the current node for a specific node
Post by cristi_talau »
Hello,
I would try to make a DFS traversal of the DOM tree and start collecting values of the "pdc" element tag after we encounter the currently selected node.
The steps will imply:
Another approach is to obtain the "#document" node, and the "getElementsByTagName()" method to obtain your "pdc.number" elements. You can also use Node.compareDocumentPosition(otherNode) to filter the ones that come after the selection.
Best,
Cristian
			
			
									
									
						I would try to make a DFS traversal of the DOM tree and start collecting values of the "pdc" element tag after we encounter the currently selected node.
The steps will imply:
- Obtaining the "#document" element of the XML DOM tree
 
- Obtaining the currently selected node
 
- Iterating the tree and collecting the desired nodes
 
Another approach is to obtain the "#document" node, and the "getElementsByTagName()" method to obtain your "pdc.number" elements. You can also use Node.compareDocumentPosition(otherNode) to filter the ones that come after the selection.
Best,
Cristian
			
				Jump to
				
			
		
			
			
	
	- Oxygen XML Editor/Author/Developer
 - ↳ Feature Request
 - ↳ Common Problems
 - ↳ DITA (Editing and Publishing DITA Content)
 - ↳ Artificial Intelligence (AI Positron Assistant add-on)
 - ↳ 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