Skip to content

xml.mod does not set content in children #36

Description

@MidimasterSoft

I have this given XML-document with a child <ChapterString>Chapter 01</ChapterString>

<?xml version="1.0"?>
<!-- <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd"> -->
<Chapters>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>1</EditionFlagDefault>
    <EditionUID>9866912279059327637</EditionUID>
    <ChapterAtom>
      <ChapterUID>1286159179066931568</ChapterUID>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeEnd>00:01:49.234125000</ChapterTimeEnd>
      <ChapterDisplay>
        <ChapterString>Chapter 01</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
  </EditionEntry>
</Chapters>

And I want to change the content of this child with...

(runnable code example)

SuperStrict

Framework text.xml
Import BRL.StandardIO

Local doc:TxmlDoc = TxmlDoc.parseFile("chapter.xml")
Local root:TxmlNode = doc.getRootElement()

ParseChildren(root.getChildren())

Function ParseChildren(children:TList)
	For Local child:TxmlNode = EachIn children
		Local name:String = child.GetName()
		Print  "NAME =" + name '+ " CONTENT=" + child.toString() + "+++++" 
		If name = "ChapterString"
			Print "*******************"
			Print "content before: --|" + child.GetContent()  + "|--"
			child.setContent("Happy")
			Print "content after: --|" +child.GetContent()   + "|--"
			Print "--done---------   "
			Print 
		EndIf
		ParseChildren(child.getChildren())
	Next
End Function 

But afterwards I observe an empty content after SetContent()

This is definitely a bug, as the user expects to exchange contents with SetContent()

I tested this with the latest version of xml.mod from yesterday night.

Protocol:

Building XMLChange
[ 86%] Processing:XMLChange.bmx
[ 93%] Compiling:XMLChange.bmx.gui.debug.win32.x64.c
[100%] Linking:XMLChange.debug.exe
Executing:XMLChange.debug.exe
NAME =EditionEntry
NAME =EditionFlagHidden
NAME =EditionFlagDefault
NAME =EditionUID
NAME =ChapterAtom
NAME =ChapterUID
NAME =ChapterTimeStart
NAME =ChapterFlagHidden
NAME =ChapterFlagEnabled
NAME =ChapterTimeEnd
NAME =ChapterDisplay
NAME =ChapterString
*******************
content before: --|Chapter 01|--
content after: --||--
--done---------   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions