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

Partial support for parsing XML namespaces #3925

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

ammachado
Copy link
Contributor

@ammachado ammachado commented Jan 16, 2024

What's changed?

Partial support for #3919, including namespace parsing and resolution

What's your motivation?

#3919

Anything in particular you'd like reviewers to focus on?

No

Anyone you would like to review specifically?

No

Have you considered any alternatives or workarounds?

No

Any additional context

No

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@ammachado ammachado marked this pull request as ready for review January 16, 2024 17:26
@timtebeek timtebeek added the enhancement New feature or request label Jan 16, 2024
@timtebeek
Copy link
Contributor

Thanks for getting this started @ammachado ! I've also tagged @knutwannheden for review since we're adding methods in the xml/tree package which require some additional scrutiny just to be safe.

@timtebeek
Copy link
Contributor

Once merged we can revisit these recipes in rewrite-migrate-java:
openrewrite/rewrite-migrate-java@9181655

if (this.root == root) {
return this;
}
Map<String, String> namespaces = XmlNamespaceUtils.extractNamespaces(root.getAttributes());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of extracting the namespaces here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we need this back in to later support namespace lookup for particular elements?

For example, using the test file, and wanting to look for the XPath /client/conduitSelector with the http://cxf.apache.org/jaxws namespace:

<jaxws:client name="{http://cxf.apache.org/hello_world_soap_http}SoapPort" createdFromAPI="true" xmlns:jaxws="http://cxf.apache.org/jaxws">
              <jaxws:conduitSelector>
                  <bean class="org.apache.cxf.endpoint.DeferredConduitSelector"/>
              </jaxws:conduitSelector>
          </jaxws:client>

@timtebeek timtebeek self-requested a review June 7, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready to Review
Development

Successfully merging this pull request may close these issues.

None yet

4 participants