Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.eclipse.lemminx.dom.DOMNode.getTextContent() seem to be implemented wrong (or incomplete) #1695

Open
laeubi opened this issue Oct 27, 2024 · 0 comments

Comments

@laeubi
Copy link
Member

laeubi commented Oct 27, 2024

org.eclipse.lemminx.dom.DOMNode.getTextContent() always return null if Eclipse is correct no class overrides DOMNode here

public String getTextContent() throws DOMException {

that simply return the value of an element while the javadoc says

ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE
concatenation of the textContent attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.

For the following example document

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>test</groupId>
	<artifactId>bnd-integration-test</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>BND-M2E Integration Test Project</name>
	<description>This project test the BND-m2e integration</description>
	<build>
		<plugins>
			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-maven-plugin</artifactId>
				<version>7.0.0</version>
				<executions>
					<execution>
						<id>bnd-process</id>
						<goals>
							<goal>bnd-process</goal>
						</goals>
						<configuration>
						<bnd>
						ssss
						<test>me</test>
						<![CDATA[ 
						  
						]]>
						</bnd>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.core</artifactId>
			<version><![CDATA[8.0.0]]></version>
		</dependency>
	</dependencies>
</project>

I get the following output for element <bnd>

Okt. 27, 2024 3:07:58 PM org.eclipse.m2e.lemminx.bnd.BndLemminxPlugin$1 onXMLContent
INFORMATION: text content=null
Okt. 27, 2024 3:07:58 PM org.eclipse.m2e.lemminx.bnd.BndLemminxPlugin$1 onXMLContent
INFORMATION: substring=<bnd>
						ssss
						<test>me</test>
						<![CDATA[ 
						  
						]]>
						</bnd>

while the text content has to be something like


						ssss
						me

						  
						
@laeubi laeubi changed the title org.eclipse.lemminx.dom.DOMNode.getTextContent() seem to be implemented wrong org.eclipse.lemminx.dom.DOMNode.getTextContent() seem to be implemented wrong (or incomplete) Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant