-
Notifications
You must be signed in to change notification settings - Fork 65
Comments
Conversation
Added the saveExtraNamespaces input parameter and modified the top-level element to write to disk to ensure that the top-level element can write extraNamespaces
pjfanning
commented
Jun 24, 2024
Could you add a unit test?
whatever098
commented
Jun 24, 2024
Could you add a unit test?
OK,I will do this
pjfanning
commented
Jul 1, 2024
@whatever098 could you give some background on why adding the unused extra namespaces is useful? I'm struggling to see how this is useful.
whatever098
commented
Jul 2, 2024
@pjfanning When we save the java code generated by xsd as xml, we need this method to set the namespace
pjfanning
commented
Jul 2, 2024
XMLBeans adds the namespace declarations that it needs. I'm against merging this. What if someone adds an 'extra namespace' with the same prefix as one that XMLBeans generates for its own needs? We've gone 20 years without needing this support.
Provide a very detailed example of why you need this - something that fails without this support - or I will remain against adding this.
You are free to fork XMLBeans and add whatever you like to your fork.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a single one of these namespaces is used in the XML. I am -1 to merging this. I see no point in supporting adding unused namespace declarations.
@pjfanning Let me explain the reason in detail. When I generate a jar with an xsd containing some namespace(such as
uof.zip
), the xml file written using the jar does not have the namespace I need and cannot be opened normally. This test process cannot be expressed by unit testing. If you need me to demonstrate it with code, I will upload a use case code package tomorrow to demonstrate why I need to use extra namespace.
55b6a1d to
16af8f6
Compare
pjfanning
commented
Jul 2, 2024
I will not merge this unless there are checks so that the extra namespaces do not clash with the namespaces that XMLBeans generates for itself.
pjfanning
commented
Jul 2, 2024
Actually, I think we should abandon this and work out why XMLBeans does not generate the correct namespaces in the 1st place.
whatever098
commented
Jul 2, 2024
You are right,I will try
@pjfanning I review my modified and found using setSaveImplicitNamespaces can achieve my appeal, but using this method will traverse the XML files twice, this could lead to problems in the performance of some of the scenes, so now I will use setSaveImplicitNamespaces moment, There may be time later to commit changes to the PR to add some checks during my free time.By the way, can you deal with the pr #19 as soon as possible, this matters to me.
Added the saveExtraNamespaces input parameter and modified the top-level element to write to disk to ensure that the top-level element can write extraNamespaces