XML stream as list of item replace?

Author: dammie@seznam.cz (dammie)

Hello, I started to think that I could replace list of items by XML streams... First: I try to learn but even my stupid examples didnt work:

 

 variables
  xmlStream [dtd:x.dict] x
endvariables

FIELD="HELLO WORLD"                                                          ; data to add to xmlstream

xmlsave/dtd x, "dtd:X.DICT","TEST=DUMMY·;A=FIELD"
 

putmess x

 

 

 IN message is text "hello world" missing ....

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X [
<!ELEMENT X (TEST.TEST*)>
<!ELEMENT TEST.TEST (A.TEST.TEST?)>
<!ELEMENT A.TEST.TEST (#PCDATA)>
]>
<X>
</X>
 

 

Second: Is there any other acces to xmlstream than xmload, xmlsave to components? I mean direct acces (eg. to list with putitem-getitem)

 

THanks David

2 Comments

  1. Hi David,

    there is a lot to know about XMLStreams and DTDs.
    Please have a closer look in the documentation.
    Not sure if there is a tutorial about XMLs.

    In short: 
     

    XMLstreams are totally different from lists.

    There are no commands for direct access to an XML element
    To get the contents of an XMLstream, you can use the XMLREADER to parse the complete XML.

    XML load/save depends strictly on the DTD (which need to be compiled first to work) and
    work directly with the painted occurences and fields on the component (watch the mapfile).

    Hope it helps for a first-aid (there are most competent members in this forum which may tell you more about it),

    Success, Uli

     


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Hi David,

     

    a first look, it seems that your Mapping isn't correct.

    UNIFACE uses full qualified named for dtd elements (its not standard).

    If you do a mapping, than you have exacty match, what is in the dtd specified.

    so you have to map:

    "TEST.TEST=DUMMY·;TEST.TEST.A=DUMMY.FIELD"

    where  dummy is your entity and field the field inside.

     

    HTH

    THOMAS


    Author: Thomas.Young (thomas.young@young-consulting.de)