> Le 27 janv. 2022 à 22:55, Alan Tilson via 4D_Tech <[email protected]> a
> écrit :
>
> Hello Keisuke,
> You make it sound simple, so how do I "parse the xml"?
> Open it in a text editor and search for "reject null values"?
> Thanks!
Hi Allan,
it seems to be "never_null".
But if you prefer a "code, do it for me" solution, I'd suggest to get the xml
as Miyako said, then convert it to object, as object is far way simpler to
browse than xml with 4D.
Get structure in XML and convert to object:
+++++++++++++++
C_TEXT($structureXML_t;$XMLroot_t)
EXPORT STRUCTURE($structureXML_t)
$XMLroot_t:=DOM Parse XML variable($structureXML_t)
If (ok=0)
$error_t:="DOM Parse XML variable failed"
Else
C_OBJECT($db4d_o)
$db4d_o:=Xml_ToObject($XMLroot_t)
DOM CLOSE XML($XMLroot_t)
End if
+++++++++++++++
An example of what you'll get:
+++++++++++++++
{
"base": {
"collation_locale": "fr",
"name": "InternalDatabase",
"uuid": "AEBAD9E131B8E24AB5A93B28C5E95DCA",
"schema": {
"name": "DEFAULT_SCHEMA"
},
"table": [
{
"id": "1",
"name": "ADHERENT",
"uuid": "8AFCE92A7A6BA548BB3BD46F5CD5A0FE",
"field": [
{
"autosequence": "true",
"id": "1",
"name": "PK",
"never_null": "true",
"type": "4",
"unique": "true",
"uuid":
"E37EF365C2A57242B395A5F3420113D7",
"index_ref": {
"uuid":
"E48A518C9DD8427BB1BA601B1A28248F"
},
"field_extra": {
"enterable": "false",
"mandatory": "true",
"modifiable": "false",
"editor_field_info": {
"color": {
"alpha": "255",
"blue":
"5",
"green": "30",
"red":
"216"
}
}
}
},
../..
+++++++++++++++
Soume source code to convert xml to object:
<https://github.com/ThomasMaul/Tools_TM/blob/master/Project/Sources/Methods/Tools_XMLToObject.4dm>
<https://discuss.4d.com/t/xml-to-object/15695/5>
<https://discuss.4d.com/t/xml-to-objects/21705/20>
--
Arnaud
**********************************************************************
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************