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

Closed
laeubi opened this issue Oct 27, 2024 · 1 comment · Fixed by #1704
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@laeubi
Copy link
Contributor

laeubi commented Oct 27, 2024

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

https://github.com/eclipse/lemminx/blob/744de35767bf762a6abcfd2337f7e931ecbaf8d1/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/dom/DOMNode.java#L829

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
@angelozerr
Copy link
Contributor

Any contribution are welcome!

laeubi added a commit to laeubi/lemminx that referenced this issue Nov 10, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 10, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 10, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 10, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 10, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 12, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 16, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
laeubi added a commit to laeubi/lemminx that referenced this issue Nov 16, 2024
Fix eclipse-lemminx#1695

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
@angelozerr angelozerr added this to the 0.29.0 milestone Nov 16, 2024
@angelozerr angelozerr added the bug Something isn't working label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants