Create XML document by GDL
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-10-26 01:21 AM
2010-10-26
01:21 AM
Thanks!
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
6 REPLIES 6

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-10-26 07:01 AM
2010-10-26
07:01 AM
Hi Frank
Depending on how you need your XML file formatted, the following code will create an xml file (a basic file with no schema). Remembering that xml is just fancy formatted text.
Hope this helps
!!-file path
fspec="C:\Your File Path\File Name.xml"
!!-First write - note this uses Mode = WO
chx = open("text",fspec,"Separator='\t',Mode = WO,FULLPATH")
OUTPUT chx, 1,1,"<Header 1>"
OUTPUT chx,1,2," <Header 2>"
close chx
!!- Create the main part of the xml file - note we use Mode = WA (Write Append Here)
!!- Loop into this sub routine as required
gosub 'Write XML Body'
!!-Finish off with this
ch = open("text",fspec,"Separator='\t',Mode = WA,FULLPATH")
OUTPUT ch,1,1," </Header 2>"
OUTPUT ch, 1,2,"</Header 1>"
close ch
end
!!=========
'Write XML Body':
ch = open("text",fspec,"Separator='\t',Mode = WA,FULLPATH")
OUTPUT ch,1,1,"<Body 1>"
OUTPUT ch,1,2,"<Field 2>" + Parameter1 + "</Field 2>"
OUTPUT ch,1,3,"<Field 3>" + Parameter2 + "</Field 3>"
OUTPUT ch,1,4,"<Field 4>" + Parameter3 + "</Field 4>"
OUTPUT ch,1,5,"<Field 5>" + Parameter4 + "</Field 5>"
OUTPUT ch,1,6,"<Field 6>"
OUTPUT ch,1,7,Parameter5
OUTPUT ch,1,8,"</Field 6>"
OUTPUT ch,1,9,"<Field 7>" + Parameter6 + "</Field 7>"
OUTPUT ch,1,10,"</Body 1>"
close ch
return
Depending on how you need your XML file formatted, the following code will create an xml file (a basic file with no schema). Remembering that xml is just fancy formatted text.
Hope this helps
!!-file path
fspec="C:\Your File Path\File Name.xml"
!!-First write - note this uses Mode = WO
chx = open("text",fspec,"Separator='\t',Mode = WO,FULLPATH")
OUTPUT chx, 1,1,"<Header 1>"
OUTPUT chx,1,2," <Header 2>"
close chx
!!- Create the main part of the xml file - note we use Mode = WA (Write Append Here)
!!- Loop into this sub routine as required
gosub 'Write XML Body'
!!-Finish off with this
ch = open("text",fspec,"Separator='\t',Mode = WA,FULLPATH")
OUTPUT ch,1,1," </Header 2>"
OUTPUT ch, 1,2,"</Header 1>"
close ch
end
!!=========
'Write XML Body':
ch = open("text",fspec,"Separator='\t',Mode = WA,FULLPATH")
OUTPUT ch,1,1,"<Body 1>"
OUTPUT ch,1,2,"<Field 2>" + Parameter1 + "</Field 2>"
OUTPUT ch,1,3,"<Field 3>" + Parameter2 + "</Field 3>"
OUTPUT ch,1,4,"<Field 4>" + Parameter3 + "</Field 4>"
OUTPUT ch,1,5,"<Field 5>" + Parameter4 + "</Field 5>"
OUTPUT ch,1,6,"<Field 6>"
OUTPUT ch,1,7,Parameter5
OUTPUT ch,1,8,"</Field 6>"
OUTPUT ch,1,9,"<Field 7>" + Parameter6 + "</Field 7>"
OUTPUT ch,1,10,"</Body 1>"
close ch
return
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-10-26 08:35 AM
2010-10-26
08:35 AM
Thanks Ben, but this is only plan b. I know, that it is just a special formatted text file, but in your example I have to handle the whole structure and syntax by myself.
What I want is to open/create the XML file directly by the XML AddOn. I can create it in this way yet, but not more than the root node so far. Creating a child node causes AC crashes. It looks like I am doing something GS programmers haven't thought of somebody could do.
What I want is to open/create the XML file directly by the XML AddOn. I can create it in this way yet, but not more than the root node so far. Creating a child node causes AC crashes. It looks like I am doing something GS programmers haven't thought of somebody could do.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-10 10:25 AM
2010-11-10
10:25 AM
Hi,
Frank tracked down a bug in the GDL XML output. I fixed it and the fix will get into Hotfix 2. More exactly, any version after build 3467 in AC14 and in all later main AC versions of course.
Until these versions get published, you're left with Ben's idea using simple text output instead:(
Sorry for the hassle,
Frank tracked down a bug in the GDL XML output. I fixed it and the fix will get into Hotfix 2. More exactly, any version after build 3467 in AC14 and in all later main AC versions of course.
Until these versions get published, you're left with Ben's idea using simple text output instead:(
Sorry for the hassle,
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-10 04:45 PM
2010-11-10
04:45 PM
Does it affect the GDL webcontrol too?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-11 07:22 PM
2010-11-11
07:22 PM
Yes. It uses the same add-on. I don't know the release and update schedule of v14 WebControl but I don't think this fix will trigger a new hotfix for webcontrol...
Zsolt Táskai
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
ArchiCAD Development - GDL Team
AC13, AC14 and upwards...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2010-11-12 12:01 AM
2010-11-12
12:01 AM


That's the environment I need it for. Writing values out of an object in webcontrol.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm