× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



RR,

In that case you might try a simple Java program running on the
PC. I would avoid the problems associated with RPG and the IFS
and go directly from the PC to your iSeries database. Java is the
language of choice with XML. I am assuming you want a real file
not just the raw XML in the database. I use a framework I built
for database/iSeries/XML support. The database support involves
quite a bit of code, but here is something to get you started:

package tests;

import java.util.List;
import java.util.ListIterator;

import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;

import org.jdom.input.SAXBuilder;

/**
 * @author David Morris
 */
public class XMLDocument {

    private Document document;

    public static void main(String[] args) {
        XMLDocument xmlDocument = new XMLDocument();
        xmlDocument.build(args[0]);
        xmlDocument.list();
        System.exit(0);
    }

    public void build(String filename) {

        try {
            SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build(filename);
            listElements(doc.getRootElement());
        }
        catch (JDOMException e) {
            e.printStackTrace();
        }
    }

    public void list() {
        listElements(getDocument().getRootElement());
    }

    private void listElements(Element element) {
        System.out.println(
                "Element name: '" + element.getName() + "' text: '" +
element.getText() + "'");

        //List all attributes
        List attributes = element.getAttributes();

        for (ListIterator i = attributes.listIterator(); i.hasNext();)
{

            Attribute attribute = (Attribute) i.next();
            System.out.println(
                    "Attribute name: '" + attribute.getName() + "'
value: '" + attribute.getValue()
                    + "'");
        }

        //List all children
        List children = element.getChildren();

        for (ListIterator i = children.listIterator(); i.hasNext();) {

            Element n = (Element) i.next();
            listElements(n);
        }
    }

    public Document getDocument() {
        return document;
    }

    public void setDocument(Document document) {
        this.document = document;
    }
}

This will list the document elements and attributes to the console. You

should be able to run this on any PC with the 1.3+ JRE or SDK. For
the database I would use JTOpen.

David Morris

>>> the400man@hotmail.com 08/16/02 11:21AM >>>
Thanks David.

The data is arriving directly to a PC (vendors choice, not mine). I
need to
get it into an EBCDIC- formatted database on the 400.

RR



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.