Skip to content

Commit

Permalink
Merge branch 'textContent'
Browse files Browse the repository at this point in the history
Conflicts:

	dom/FoX_dom.f90
	dom/m_dom_attribute.m4
	dom/m_dom_dom.f90
	dom/m_dom_node.m4
	dom/m_dom_text.m4
  • Loading branch information
Toby White committed Dec 21, 2007
2 parents 601e0fd + 213358d commit c5c1574
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 94 deletions.
25 changes: 1 addition & 24 deletions dom/m_dom_attribute.m4
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ TOHW_m_dom_get(Node, ownerElement, np%elExtras%ownerElement, (ATTRIBUTE_NODE))
type(Node), pointer :: arg
character(len=getTextContent_len(arg, associated(arg))) :: c

integer :: i, n

if (.not.associated(arg)) then
TOHW_m_dom_throw_error(FoX_NODE_IS_NULL)
endif
Expand All @@ -58,28 +56,7 @@ TOHW_m_dom_get(Node, ownerElement, np%elExtras%ownerElement, (ATTRIBUTE_NODE))
type(Node), pointer :: np
integer :: i

if (.not.associated(arg)) then
TOHW_m_dom_throw_error(FoX_NODE_IS_NULL)
endif

if (getNodeType(arg)/=ATTRIBUTE_NODE) then
TOHW_m_dom_throw_error(FoX_INVALID_NODE)
elseif (arg%readonly) then
TOHW_m_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR)
elseif (.not.checkChars(value, getXmlVersionEnum(getOwnerDocument(arg)))) then
TOHW_m_dom_throw_error(FoX_INVALID_CHARACTER)
endif

do i = 1, getLength(getChildNodes(arg))
call destroyNode(arg%childNodes%nodes(i)%this)
enddo
deallocate(arg%childNodes%nodes)
allocate(arg%childNodes%nodes(0))
arg%childNodes%length = 0
arg%firstChild => null()
arg%lastChild => null()
np => createTextNode(getOwnerDocument(arg), value)
np => appendChild(arg, np)
call setTextContent(arg, value)

end subroutine setValue

Expand Down
4 changes: 2 additions & 2 deletions dom/m_dom_common.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ TOHW_m_dom_contents(`
TOHW_subroutine(setData, (arg, data))
type(Node), pointer :: arg
character(len=*) :: data

integer :: n

integer :: n

if (.not.associated(arg)) then
TOHW_m_dom_throw_error(FoX_NODE_IS_NULL)
endif
Expand Down
65 changes: 3 additions & 62 deletions dom/m_dom_dom.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,6 @@ subroutine setNodeValue(arg, nodeValue, ex)
type(Node), pointer :: arg
character(len=*) :: nodeValue

type(Node), pointer :: np

if (.not.associated(arg)) then
if (getFoX_checks().or.FoX_NODE_IS_NULL<200) then
call throw_exception(FoX_NODE_IS_NULL, "setNodeValue", ex)
Expand Down Expand Up @@ -1090,7 +1088,6 @@ subroutine setNodeValue(arg, nodeValue, ex)
call setValue(arg, nodeValue)
case (CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE)
call setData(arg, nodeValue)

end select

end subroutine setNodeValue
Expand Down Expand Up @@ -9611,8 +9608,6 @@ function getValue_DOM(arg, ex)result(c)
type(Node), pointer :: arg
character(len=getTextContent_len(arg, associated(arg))) :: c

integer :: i, n

if (.not.associated(arg)) then
if (getFoX_checks().or.FoX_NODE_IS_NULL<200) then
call throw_exception(FoX_NODE_IS_NULL, "getValue_DOM", ex)
Expand Down Expand Up @@ -9649,60 +9644,7 @@ subroutine setValue(arg, value, ex)
type(Node), pointer :: np
integer :: i

if (.not.associated(arg)) then
if (getFoX_checks().or.FoX_NODE_IS_NULL<200) then
call throw_exception(FoX_NODE_IS_NULL, "setValue", ex)
if (present(ex)) then
if (inException(ex)) then
return
endif
endif
endif

endif

if (getNodeType(arg)/=ATTRIBUTE_NODE) then
if (getFoX_checks().or.FoX_INVALID_NODE<200) then
call throw_exception(FoX_INVALID_NODE, "setValue", ex)
if (present(ex)) then
if (inException(ex)) then
return
endif
endif
endif

elseif (arg%readonly) then
if (getFoX_checks().or.NO_MODIFICATION_ALLOWED_ERR<200) then
call throw_exception(NO_MODIFICATION_ALLOWED_ERR, "setValue", ex)
if (present(ex)) then
if (inException(ex)) then
return
endif
endif
endif

elseif (.not.checkChars(value, getXmlVersionEnum(getOwnerDocument(arg)))) then
if (getFoX_checks().or.FoX_INVALID_CHARACTER<200) then
call throw_exception(FoX_INVALID_CHARACTER, "setValue", ex)
if (present(ex)) then
if (inException(ex)) then
return
endif
endif
endif

endif

do i = 1, getLength(getChildNodes(arg))
call destroyNode(arg%childNodes%nodes(i)%this)
enddo
deallocate(arg%childNodes%nodes)
allocate(arg%childNodes%nodes(0))
arg%childNodes%length = 0
arg%firstChild => null()
arg%lastChild => null()
np => createTextNode(getOwnerDocument(arg), value)
np => appendChild(arg, np)
call setTextContent(arg, value)

end subroutine setValue

Expand Down Expand Up @@ -10541,7 +10483,6 @@ subroutine setIsElementContentWhitespace(np, isElementContentWhitespace, ex)
endif

call updateTextContentLength(np, n)

end subroutine setIsElementContentWhitespace

! function getWholeText
Expand Down Expand Up @@ -10609,9 +10550,9 @@ subroutine setData(arg, data, ex)
type(DOMException), intent(out), optional :: ex
type(Node), pointer :: arg
character(len=*) :: data

integer :: n

integer :: n

if (.not.associated(arg)) then
if (getFoX_checks().or.FoX_NODE_IS_NULL<200) then
call throw_exception(FoX_NODE_IS_NULL, "setData", ex)
Expand Down
3 changes: 0 additions & 3 deletions dom/m_dom_node.m4
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ TOHW_m_dom_get(DOMString, nodeName, np%nodeName)
type(Node), pointer :: arg
character(len=*) :: nodeValue

type(Node), pointer :: np

if (.not.associated(arg)) then
TOHW_m_dom_throw_error(FoX_NODE_IS_NULL)
endif
Expand All @@ -100,7 +98,6 @@ TOHW_m_dom_get(DOMString, nodeName, np%nodeName)
call setValue(arg, nodeValue)
case (CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE)
call setData(arg, nodeValue)

end select

end subroutine setNodeValue
Expand Down
1 change: 0 additions & 1 deletion dom/m_dom_text.m4
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ TOHW_m_dom_get(logical, isElementContentWhitespace, np%ignorableWhitespace, (TEX
endif

call updateTextContentLength(np, n)

end subroutine setIsElementContentWhitespace

! function getWholeText
Expand Down
3 changes: 1 addition & 2 deletions dom/m_dom_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ subroutine iter_dmp_xml(xf, arg, ex)
doneAttributes = .false.
this => treeroot
do

if (.not.doneChildren.and..not.(getNodeType(this)==ELEMENT_NODE.and.doneAttributes)) then
select case(getNodeType(this))
case (ELEMENT_NODE)
Expand Down Expand Up @@ -353,7 +352,7 @@ subroutine iter_dmp_xml(xf, arg, ex)
if (.not.doneChildren) then
if (getNodeType(this)==ELEMENT_NODE.and..not.doneAttributes) then
if (getLength(getAttributes(this))>0) then
this => item(getAttributes(this), 0)
this => item(getAttributes(this), 0)
else
doneAttributes = .true.
endif
Expand Down

0 comments on commit c5c1574

Please sign in to comment.