Loading ...
Sorry, an error occurred while loading the content.

Re: storeDocument does not work - (maybe solved)

Expand Messages
  • uwez2004
    The Proplem disapeared when i replaced the null parameter with the p Object in t.storeDocument(). Guess (hope) this was the problem, though i don t
    Message 1 of 5 , Apr 1, 2004
    • 0 Attachment
      The Proplem disapeared when i replaced the "null" parameter with
      the "p" Object in t.storeDocument().
      Guess (hope) this was the problem, though i don't understand the
      sense in that, because we build the Transfer Object with the Property
      Object as parameter.

      thanks




      --- In xml-dbms@yahoogroups.com, "uwez2004" <zietzling@g...> wrote:
      > Hi,
      >
      > first of all, i have to say "thank you" for your fast help!
      >
      > Now i'm using "xmldbms20alpha3" with xerces.
      > I try to get the following procedure running:
      > //-----------------------
      > p.load(new FileInputStream("parser.props"));
      > Transfer t = new Transfer(p);
      > p.load(new FileInputStream("db.props"));
      > t.setDatabaseProperties(p);
      > t.storeDocument(null,"repl.xml","neu.map","order1.act");
      > //-----------------------
      > Though i'm not shure about the properness of my *.xml,*.map an
      *.act
      > files, i guess, that the following Exception should not occur:
      >
      > "java.lang.NullPointerException at
      > org.xmlmiddleware.xmldbms.tools.Transfer.storeDocumentInternal
      > (Transfer.java:828)
      > at org.xmlmiddleware.xmldbms.tools.Transfer.storeDocument
      > (Transfer.java:479)
      > "
      > "org.xmlmiddleware.xmldbms.tools.Transfer.storeDocument, line 473.
      > Source of class has not been found in mounted Filesystem."
      >
      >
      > Is there something missing in this path?
    • uwez2004
      Hy, .. its me again the next error i get, is: Element type not mapped as a class: lfn but, as far as i understand Mapping-Files, my configuration is set
      Message 2 of 5 , Apr 2, 2004
      • 0 Attachment
        Hy, .. its me again

        the next error i get, is:
        " Element type not mapped as a class: lfn "

        but, as far as i understand Mapping-Files, my configuration is set
        correctly (as you can verify, bellow my dtd, map, action an xml File).

        thank you in advance
        Uwe

        ------------------------------------------
        physical schema in Database
        ===========================
        Table Name = "REPLTAB"
        Columms = "LFN" Primary Key
        "EXTID"
        "LAENGE"
        "AUFGABE"
        -----------------------------------------------
        repl.xml
        ========
        <repl>
        <repltab>
        <lfn>1</lfn>
        <extid>40</extid>
        <laenge>Vollzeit</laenge>
        <aufgabe>Maschienenbau</aufgabe>
        </repltab>
        <repltab>
        <lfn>2</lfn>
        <extid>41</extid>
        <laenge>Teilzeit</laenge>
        <aufgabe>Informatik</aufgabe>
        </repltab>
        </repl>
        -----------------------------------------------
        map.map
        ==========
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd">
        <XMLToDBMS xmlns="http://www.xmlmiddleware.org/xmldbms/v2"
        Version="2.0">
        <Options>
        <SimpleDateFormat DefaultForTypes="TIMESTAMP" Pattern="yyyy-MM-dd
        HH:mm:ss.S"/>
        </Options>
        <Databases>
        <Database Name="Default">
        <Catalog>
        <Schema>
        <Table Name="REPLTAB">
        <Column DataType="VARCHAR" Length="10"
        Name="LFN"/>
        <Column DataType="VARCHAR" Length="10"
        Name="EXTID"/>
        <Column DataType="VARCHAR" Length="20"
        Name="LAENGE"/>
        <Column DataType="VARCHAR" Length="20"
        Name="AUFGABE"/>
        <PrimaryKey>
        <UseColumn Name="LFN"/>
        </PrimaryKey>
        </Table>
        </Schema>
        </Catalog>
        </Database>
        </Databases>
        <Maps>
        <ClassMap>
        <ElementType Name="repltab"/>
        <ToClassTable Name="REPLTAB"/>
        <PropertyMap>
        <ElementType Name="lfn"/>
        <ToColumn Name="LFN"/>
        </PropertyMap>
        <PropertyMap>
        <ElementType Name="extid"/>
        <ToColumn Name="EXTID"/>
        </PropertyMap>
        <PropertyMap>
        <ElementType Name="laenge"/>
        <ToColumn Name="LAENGE"/>
        </PropertyMap>
        <PropertyMap>
        <ElementType Name="aufgabe"/>
        <ToColumn Name="AUFGABE"/>
        </PropertyMap>
        </ClassMap>
        </Maps>
        -----------------------------------------------
        order1.act
        ==========
        <!DOCTYPE Actions SYSTEM "actions.dtd">
        <Actions Version="2.0"
        xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
        <DefaultAction>
        <Insert />
        </DefaultAction>
        <Action>
        <ElementType Name="lfn" />
        <UpdateOrInsert />
        </Action>
        <Action>
        <ElementType Name="extid" />
        <UpdateOrInsert />
        </Action>
        <Action>
        <ElementType Name="laenge" />
        <UpdateOrInsert />
        </Action>
        <Action>
        <ElementType Name="aufgabe" />
        <UpdateOrInsert />
        </Action>
        </Actions>
        -------------------------------------
        dtd.dtd
        =======
        <?xml version='1.0' encoding='UTF-8'?>
        <!ELEMENT aufgabe (#PCDATA)>
        <!ELEMENT laenge (#PCDATA)>
        <!ELEMENT extid (#PCDATA)>
        <!ELEMENT lfn (#PCDATA)>
        <!ELEMENT repltab (aufgabe|laenge|extid|lfn)*>
        <!ELEMENT repl (repltab)*>
        ------------------------------------
      • Ronald Bourret
        This is a bug in the code. storeDocumentInternal assumes that the Properties object is non-null and checks for various optional properties, such as whether to
        Message 3 of 5 , Apr 6, 2004
        • 0 Attachment
          This is a bug in the code. storeDocumentInternal assumes that the
          Properties object is non-null and checks for various optional
          properties, such as whether to perform validation.

          Passing any Properties object to storeDocument solves the problem
          because storeDocumentInternal can then check for the properties it
          needs. It doesn't matter if the properties aren't there, since the code
          knows that these are optional properties and might be missing.

          -- Ron

          uwez2004 wrote:
          >
          > The Proplem disapeared when i replaced the "null" parameter with
          > the "p" Object in t.storeDocument().
          > Guess (hope) this was the problem, though i don't understand the
          > sense in that, because we build the Transfer Object with the Property
          > Object as parameter.
          >
          > thanks
          >
          > --- In xml-dbms@yahoogroups.com, "uwez2004" <zietzling@g...> wrote:
          > > Hi,
          > >
          > > first of all, i have to say "thank you" for your fast help!
          > >
          > > Now i'm using "xmldbms20alpha3" with xerces.
          > > I try to get the following procedure running:
          > > //-----------------------
          > > p.load(new FileInputStream("parser.props"));
          > > Transfer t = new Transfer(p);
          > > p.load(new FileInputStream("db.props"));
          > > t.setDatabaseProperties(p);
          > > t.storeDocument(null,"repl.xml","neu.map","order1.act");
          > > //-----------------------
          > > Though i'm not shure about the properness of my *.xml,*.map an
          > *.act
          > > files, i guess, that the following Exception should not occur:
          > >
          > > "java.lang.NullPointerException at
          > > org.xmlmiddleware.xmldbms.tools.Transfer.storeDocumentInternal
          > > (Transfer.java:828)
          > > at org.xmlmiddleware.xmldbms.tools.Transfer.storeDocument
          > > (Transfer.java:479)
          > > "
          > > "org.xmlmiddleware.xmldbms.tools.Transfer.storeDocument, line 473.
          > > Source of class has not been found in mounted Filesystem."
          > >
          > >
          > > Is there something missing in this path?
        • Ronald Bourret
          You must assign actions on a per-table basis, not a per-column basis. For example, it would not be possible to update the LFN column but insert the EXTID
          Message 4 of 5 , Apr 6, 2004
          • 0 Attachment
            You must assign actions on a per-table basis, not a per-column basis.
            For example, it would not be possible to update the LFN column but
            insert the EXTID column. Fortunately, you want to update-or-insert all
            columns.

            To do this, your action file should be as follows. Notice that the
            element type to which you are assigning an action is a "class" element
            type -- that is, an element type mapped with a ClassMap element.

            <!DOCTYPE Actions SYSTEM "actions.dtd">
            <Actions Version="2.0"
            xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
            <DefaultAction>
            <Insert />
            </DefaultAction>
            <Action>
            <ElementType Name="repltab" />
            <UpdateOrInsert />
            </Action>
            </Actions>

            I also noticed that your map won't work for all documents that are valid
            for your DTD. In particular, your DTD states:

            <!ELEMENT repltab (aufgabe|laenge|extid|lfn)*>

            This means, for example, that a repltab element can have 10 aufgabe
            children and no laenge, extid, or lfn children. If this is really what
            you want, then aufgabe, laenge, extid, and lfn must each be mapped to
            their own tables. However, I suspect one of two things:

            1) This is a generated DTD and the repltab element is really defined as
            follows:

            <!ELEMENT repltab (lfn, extid, laenge, aufgabe)>

            -- OR --

            2) A repltab element can have at most one lfn, extid, laenge, and
            aufgabe child, but you don't care what order they occur in. Since DTDs
            do not support the "don't care about order" idea, you used a choice
            group.

            In either of these cases, lfn, extid, laenge, and aufgabe can be mapped
            to columns in the repltab table.

            -- Ron

            uwez2004 wrote:
            >
            > Hy, .. its me again
            >
            > the next error i get, is:
            > " Element type not mapped as a class: lfn "
            >
            > but, as far as i understand Mapping-Files, my configuration is set
            > correctly (as you can verify, bellow my dtd, map, action an xml File).
            >
            > thank you in advance
            > Uwe
            >
            > ------------------------------------------
            > physical schema in Database
            > ===========================
            > Table Name = "REPLTAB"
            > Columms = "LFN" Primary Key
            > "EXTID"
            > "LAENGE"
            > "AUFGABE"
            > -----------------------------------------------
            > repl.xml
            > ========
            > <repl>
            > <repltab>
            > <lfn>1</lfn>
            > <extid>40</extid>
            > <laenge>Vollzeit</laenge>
            > <aufgabe>Maschienenbau</aufgabe>
            > </repltab>
            > <repltab>
            > <lfn>2</lfn>
            > <extid>41</extid>
            > <laenge>Teilzeit</laenge>
            > <aufgabe>Informatik</aufgabe>
            > </repltab>
            > </repl>
            > -----------------------------------------------
            > map.map
            > ==========
            > <?xml version="1.0" encoding="UTF-8"?>
            > <!DOCTYPE XMLToDBMS SYSTEM "xmldbms2.dtd">
            > <XMLToDBMS xmlns="http://www.xmlmiddleware.org/xmldbms/v2"
            > Version="2.0">
            > <Options>
            > <SimpleDateFormat DefaultForTypes="TIMESTAMP" Pattern="yyyy-MM-dd
            > HH:mm:ss.S"/>
            > </Options>
            > <Databases>
            > <Database Name="Default">
            > <Catalog>
            > <Schema>
            > <Table Name="REPLTAB">
            > <Column DataType="VARCHAR" Length="10"
            > Name="LFN"/>
            > <Column DataType="VARCHAR" Length="10"
            > Name="EXTID"/>
            > <Column DataType="VARCHAR" Length="20"
            > Name="LAENGE"/>
            > <Column DataType="VARCHAR" Length="20"
            > Name="AUFGABE"/>
            > <PrimaryKey>
            > <UseColumn Name="LFN"/>
            > </PrimaryKey>
            > </Table>
            > </Schema>
            > </Catalog>
            > </Database>
            > </Databases>
            > <Maps>
            > <ClassMap>
            > <ElementType Name="repltab"/>
            > <ToClassTable Name="REPLTAB"/>
            > <PropertyMap>
            > <ElementType Name="lfn"/>
            > <ToColumn Name="LFN"/>
            > </PropertyMap>
            > <PropertyMap>
            > <ElementType Name="extid"/>
            > <ToColumn Name="EXTID"/>
            > </PropertyMap>
            > <PropertyMap>
            > <ElementType Name="laenge"/>
            > <ToColumn Name="LAENGE"/>
            > </PropertyMap>
            > <PropertyMap>
            > <ElementType Name="aufgabe"/>
            > <ToColumn Name="AUFGABE"/>
            > </PropertyMap>
            > </ClassMap>
            > </Maps>
            > -----------------------------------------------
            > order1.act
            > ==========
            > <!DOCTYPE Actions SYSTEM "actions.dtd">
            > <Actions Version="2.0"
            > xmlns="http://www.xmlmiddleware.org/xmldbms/actions/v2">
            > <DefaultAction>
            > <Insert />
            > </DefaultAction>
            > <Action>
            > <ElementType Name="lfn" />
            > <UpdateOrInsert />
            > </Action>
            > <Action>
            > <ElementType Name="extid" />
            > <UpdateOrInsert />
            > </Action>
            > <Action>
            > <ElementType Name="laenge" />
            > <UpdateOrInsert />
            > </Action>
            > <Action>
            > <ElementType Name="aufgabe" />
            > <UpdateOrInsert />
            > </Action>
            > </Actions>
            > -------------------------------------
            > dtd.dtd
            > =======
            > <?xml version='1.0' encoding='UTF-8'?>
            > <!ELEMENT aufgabe (#PCDATA)>
            > <!ELEMENT laenge (#PCDATA)>
            > <!ELEMENT extid (#PCDATA)>
            > <!ELEMENT lfn (#PCDATA)>
            > <!ELEMENT repltab (aufgabe|laenge|extid|lfn)*>
            > <!ELEMENT repl (repltab)*>
            > ------------------------------------
          Your message has been successfully submitted and would be delivered to recipients shortly.