I know what you're trying to do, but its very difficult because there are many levels. I made a sort of schema from my xml
1. Brands
1.1. Section:
1.1.1. Formats
1.1.2. Illustrationlink
1.1.3. Description
1.1.4. Section:
1.1.4.1.description
1.1.4.2.illustrationlink
1.1.4.3.model ( attribute "id"):
1.1.4.3.1. modellink
1.1.4.3.2. illustrationlink
1.1.4.3.3. description
1.1.4.4.section:
1.1.4.4.1. description
1.1.4.4.2. document:
1.1.4.4.2.1.documentlink
1.1.4.4.2.2.descripton
1.1.4.4.3. section:
1.1.4.4.3.1.description
1.1.4.4.3.2.section:
1.1.4.4.3.2.1. description
1.1.4.4.3.2.2. section:
1.1.4.4.3.2.2.1.description
1.1.4.4.3.2.2.2.document:
1.1.4.4.3.2.2.2.1. documentlink
1.1.4.4.3.2.2.2.2. description
1.1.4.4.3.2.3. document:
1.1.4.4.3.2.3.1.documentlink
1.1.4.4.3.2.3.2.description
like you can see it has many levels with the same names. some sublevels are more then 1 time in another level. for example, a section can contain more then 1 models.
maybe someone can help me with the 1ste thing i want to do. i want to put each model where the modellink exist in a temp-table. Therefor i need the description of the section, a attribute of model ( called "id" ) and the value of modellink. ( the
red ones ).
i used a sample of progress for the saxreader:
define temp-table ttBrands
fields ...
DEFINE VARIABLE hBuf AS HANDLE.
DEFINE VARIABLE hDBFld AS HANDLE.
DEFINE VARIABLE currentFieldValue AS CHARACTER.
DEFINE VARIABLE iProcessingState AS INTEGER.
hBuf = BUFFER ttBrands:HANDLE.
&SCOPED-DEFINE READY-TO-START 1
&SCOPED-DEFINE GETTING-RECORDS 2
&SCOPED-DEFINE GETTING-FIELDS 3
&SCOPED-DEFINE DONE 4
PROCEDURE StartDocument:
iProcessingState = {&READY-TO-START}.
END.
PROCEDURE StartElement:
DEFINE INPUT PARAMETER namespaceURI AS CHARACTER.
DEFINE INPUT PARAMETER localName AS CHARACTER.
DEFINE INPUT PARAMETER qName AS CHARACTER.
DEFINE INPUT PARAMETER attributes AS HANDLE.
IF qName = "Brand" THEN
iProcessingState = {&GETTING-RECORDS}.
ELSE IF qName = "Section" THEN DO:
iProcessingState = {&GETTING-FIELDS}.
CREATE ttBrands.
END.
ELSE IF iProcessingState = {&GETTING-FIELDS} THEN DO:
hDBFld = hBuf:BUFFER-FIELD(qName).
currentFieldValue = "".
END.
END.
PROCEDURE Characters:
DEFINE INPUT PARAMETER charData AS MEMPTR.
DEFINE INPUT PARAMETER numChars AS INTEGER.
currentFieldValue =
currentFieldValue + GET-STRING(charData, 1, GET-SIZE(charData)).
END.
PROCEDURE EndElement:
DEFINE INPUT PARAMETER namespaceURI AS CHARACTER.
DEFINE INPUT PARAMETER localName AS CHARACTER.
DEFINE INPUT PARAMETER qName as CHARACTER.
IF localName = "Brand" THEN
iProcessingState = {&DONE}.
ELSE IF localName = "Section" THEN
iProcessingState = {&GETTING-FIELDS}.
ELSE IF iProcessingState = {&GETTING-FIELDS} THEN
hDBFld:BUFFER-VALUE = currentFieldValue.
END.
PROCEDURE EndDocument:
FOR EACH ttbrands:
display ttBrands.
END.
RUN Cleanup.
END.
PROCEDURE FatalError:
DEFINE INPUT PARAMETER errMessage AS CHARACTER.
SELF
RIVATE-DATA = "FATAL".
RUN Cleanup.
RETURN ERROR errMessage
+ "(Line " + STRING(SELF:LOCATOR-LINE-NUMBER)
+ ", Col " + STRING(SELF:LOCATOR-COLUMN-NUMBER)
+ ")".
END.
PROCEDURE Cleanup:
hBuf:EMPTY-TEMP-TABLE( ).
END.