Created
December 23, 2015 20:53
-
-
Save fushnisoft/66cbf633609ddf46376a to your computer and use it in GitHub Desktop.
possible fix for toDOM:AppendCol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toDOM:AppendCol procedure(*XMLExchange exch, *Document doc, *Element rowE, StructWrapper sw, signed col, DOMStyle style) | |
colE &Element, auto | |
colA &Attr, auto | |
cs CStringClass | |
value CStringClass | |
fldFormat XMLFieldFormat | |
tp UNSIGNED | |
T &Text, auto | |
CData &CDATASection | |
code | |
tp=sw.getFieldType(col) | |
if style = DOMStyle:ADO_26 then | |
!Attribute-based style | |
!Add attribute to the DOM | |
if sw.getXMLFieldFormatByIndex(col, fldFormat) = CPXMLErr:NoError then | |
if fldFormat = XMLFieldFormat:CData | |
return CPXMLErr:CDataNotSupported | |
elsif fldFormat = XMLFieldFormat:Base64 | |
return CPXMLErr:Base64NotSupported | |
end | |
end | |
colA &= doc.createAttribute(cs.str(sw.getXMLFieldLabel(col))) !was lower(tag) [MAL] | |
rowE.setAttributeNode(colA) | |
colA.setValue(cs.str(clip(sw.getFieldValueByIndex(col)))) | |
colA.release() | |
elsif style = DOMStyle:ADO_Net then | |
!tag-based style | |
!Add new element to the DOM corresponding to column | |
colE &= doc.createElement(cs.str(sw.getXMLFieldLabel(col))) !was lower(tag) [MAL] | |
rowE.appendChild(colE) | |
if sw.getXMLFieldFormatByIndex(col, fldFormat) <> CPXMLErr:NoError then | |
T &= doc.createTextNode(cs.str(clip(sw.getFieldValueByIndex(col)))) | |
if NOT T &= NULL | |
colE.appendChild(T) | |
T.Release() | |
end | |
else | |
! test field format | |
if fldFormat = XMLFieldFormat:CData then | |
CData &= doc.createCDATASection(cs.str(clip(sw.getFieldValueByIndex(col)))) | |
if NOT CData &= NULL | |
colE.appendChild(T) | |
CData.Release() | |
end | |
elsif fldFormat = XMLFieldFormat:Base64 then | |
exch.setNamespace() | |
colE.setAttribute(e:XsiType, e:Base64) | |
value.str(clip(sw.getFieldValueByIndex(col))) | |
cs.str(tobase64(value.str())) | |
T &= doc.createTextNode(cs.str()) | |
if NOT T &= NULL | |
colE.appendChild(T) | |
T.Release() | |
end | |
else | |
!usual case | |
colE.appendChild(doc.createTextNode(cs.str(clip(sw.getFieldValueByIndex(col))))) | |
end | |
end | |
colE.release() | |
else | |
assert(false, '<13,10>Unknown DOMStyle: ' & style) | |
end | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment