-
Notifications
You must be signed in to change notification settings - Fork 117
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
Namespace prefix starting mit xml are marked as illegal #126
Comments
Ouch. OK, I understand your predicament. This is not something trivial to fix because JDOM cannot simply blanket-accept xml-prefixed namespace values. There will need to be some sort of configuration to 'disable' the error-handling.... in a few places. Do you have a suggestion as to how you would like to see it fixed? (not the code changes, but a desription of the behaviour - although code-changes would be acceptable too ;-) It will still need to disallow users from creating xml-starting namespaces. |
Is it possible for you to provide a full example XML document I can test against? I guess I coud manufacture one myself, but would prefer your use-case. |
Why can't we blanket-accept xml-prefixed namespace prefixes? Isn't that what the spec is telling us we must do? So just remove the Verifier check:
And perhaps add in its place a check that user code isn't defining "xml" or "xmlns". |
I would definitively hinder a client creating such namespace prefixes but would not fail if a file with such prefixes is read. |
Seems to me like the spec is written this way ("MUST NOT fail") so that when a new xmlfoo prefix comes out via the standards process, they want tools like JDOM to not reject it. So we should probably accept it, right? A warning or something would be nice, but there's no real vehicle for that that comes to mind. |
There is a vehicle for checking, or not checking the XML content as it is being loaded through a 'trusted' parser, but, even the unchecked version still will fail because the namespace will fail to be created. I think the right solution here may be to just remove the checking, and document, document, and document it. As soon as you say that JDOM should be able to load such files, it is only logical that it should be able to edit, and create them too. JDOM is about amking the possible things 'easy'.... but, this feels like a long enough piece of rope that it could backfire .... JDOM is not the only code that will fail with such things, surely? Then it will become JDOM's fault for letting the user create broken documents.... hmmm.... rock, and hard place. Putting system-wide configuration options (like System properties, etc.) is not a viable solution, and Namespace class is a static one. At this point in time we either change nothing (keep the fail), or change everything (not restrict anything). Those are the only two alternatives. I can't see a compromise. Am I missing something? |
The spec clearly says we have to let it pass, so we should do that, no restriction. |
Right, I agree here... I think it is the consensus. I have some other items backlogged and will push them through 'real soon'. |
I am not really familiar with JDOM but isn't is possible to control the creation of such namespace prefixes with a properties Map? |
So, I am working on this right now. Question, from the specification: http://www.w3.org/TR/REC-xml-names/#xmlReserved
Question, is the prefix 'XML' (uppercase), or 'XmL', or 'XmLnS' valid? (i.e. mixed case versions of the reserved prefixes) I am working on the literal interpretation that Xml and XMLns, etc. are 'OK' |
The first two paragraphs do not strictly require case-insensitivity but see this (http://www.w3.org/TR/2000/WD-xml-2e-20000814#dt-name), defintion for Name. |
That The following document validates 'good' using xmllint on my linux box:
|
Rolf, Element names are not discussed in this ticket, namespace prefixes only. |
My reading is that we need to allow other character cases. They're reserved and people should not use them, but the spec says we're not allowed to treat them as fatal errors. |
OK, that's where I have things in the currently committed code here. It accepts:
and I think that's OK, and it will stay that way. ;-) Just sorting out some merges, etc. Release 2.0.6 real soon now. |
Code will now validate xml-prefixed values in any combinations of text/case, except the two prefixes 'xml' and 'xmlns' (both in lower case) which have special handling. |
I am using JDOM with JMeter and the XML Assertion. My sample unfortunately includes following element:
So, unfortunately, the producing service uses a custom namespace prefix beginning with "xml". According to this one SHOULD NOT use such a prefix and the processor MUST NOT fail.
JDOM fails. This is erractic behavior.
The text was updated successfully, but these errors were encountered: