Closed
Bug 283376
Opened 20 years ago
Closed 20 years ago
GetTypeForControl API needs to return default type for node
Categories
(Core Graveyard :: XForms, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: aaronr, Assigned: aaronr)
References
Details
Attachments
(1 file, 5 obsolete files)
|
8.66 KB,
patch
|
Details | Diff | Splinter Review |
nsXFormsModelElement::GetTypeForControl calls nsXFormsUtils::ParseTypeFromNode. Neither return a type of 'string' which is the default type for an instance node if there is no @type or type MIP bound to the instance node. nsXFormsUtils::ParseTypeFromNode is probably the right place to do this work. Things to make sure about is handling type="" and that we return the proper NS prefix for the document that the node is in.
This patch will need to change to accept properties once bug 283004 goes in
Attachment #175376 -
Attachment is obsolete: true
merged this patch with 283004 and ran into problems. lookupPrefix failing if the document doesn't have the http://www.w3.org/2001/XMLSchema defined to a prefix and it sometimes fails even if it is set. We'll have to change the code in ValidateNode and GetTypeForControl to accept a failure from nsXFormsUtils::ParseTypeFromNode and pass in 'http://www.w3.org/2001/XMLSchema' and 'string' to nsXFormsSchemaValidator::GetType()
Changed ParseTypeFromNode to return NS_ERROR_NOT_AVAILABLE if type attribute not found. Also changed ValidateNode and GetTypeForControl to use this return to set up 'xsd:string' as the type to use in those situations. Doing this patch seperately from 283004 since that bug seems to be at an impass at the moment -> waiting for the ability to put properties on attributes, I believe. Allan, should we just put this patch as part of 283004, or put it in ahead of 283004?
Attachment #175377 -
Attachment is obsolete: true
Comment 5•20 years ago
|
||
(In reply to comment #4) > Created an attachment (id=175492) [edit] > 2nd attempt Just glanced at the code ... having the exact code at two places, does not seem that good? > Allan, should we just put this patch as part of 283004, or put it in > ahead of 283004? Just go ahead with this one.
consolidated as much as I could so that code exists in one place (GetTypeAndNSFromNode) and called from two places (ValidateNode and GetTypeForControl)
Attachment #175492 -
Attachment is obsolete: true
Attachment #175571 -
Flags: review?(doronr)
Comment 7•20 years ago
|
||
Comment on attachment 175571 [details] [diff] [review] 3rd attempt nits given over IRC.
Attachment #175571 -
Flags: review?(doronr) → review-
Attachment #175571 -
Attachment is obsolete: true
Attachment #175576 -
Flags: review?(doronr)
Comment 9•20 years ago
|
||
Comment on attachment 175576 [details] [diff] [review] fixed Doron's nits >+ if(!typeExists) { >+ return NS_ERROR_NOT_AVAILABLE; >+ } should be if (), other than that, r=me
Attachment #175576 -
Flags: review?(doronr) → review+
Comment on attachment 175576 [details] [diff] [review] fixed Doron's nits >+ PRBool typeExists = PR_FALSE; >+ nodeElem->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE), >+ NS_LITERAL_STRING("type"), &typeExists); >+ if(!typeExists) { >+ return NS_ERROR_NOT_AVAILABLE; >+ } >+ > nsAutoString typeAttribute; > nodeElem->GetAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_XML_SCHEMA_INSTANCE), > NS_LITERAL_STRING("type"), typeAttribute); > You could use named literal strings for NS_NAMESPACE_XML_SCHEMA_INSTANCE and "type". With those r=me
| Assignee | ||
Comment 11•20 years ago
|
||
I fixed Doron and Olli's suggestions. Doron, please check in for me.
Attachment #175576 -
Attachment is obsolete: true
Comment 12•20 years ago
|
||
checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•