I found the problem...

Apple says:

  The "id" attribute refers to the identification number of an element
  representing an object. It is generated the first time the object is
  encountered during serialization. Subsequent references to the same object use
  the attribute "idRef" instead of a new element with the complete object
  description.

so when I do XML.. some objects are written only a time...
example...


FIRST ISTANCE !

<object id="59" key="brand">
                    <class idRef="40" name="brand"/>
                    <long field="version">5000</long>
                    <object field="editingContext" idRef="22"/>
                    <object field="globalID" id="60">
                        <class idRef="23" name="com.webobjects.eocontrol._EOIntegralKeyGlobalID"/>
                        <string field="entityName" idRef="43"/>
                        <object field="guessedName"/>
                        <string field="subEntityName" idRef="43" ignoreEDB="1"/>
                        <object field="keyValue" id="61" ignoreEDB="1">
                            <class idRef="32" name="java.lang.Integer"/>
                            <int field="value">4</int>
                        </object>
                    </object>
                    <object field="properties" ignoreEDB="1"/>
                    <object field="classDescription" idRef="45" ignoreEDB="1"/>
                    <string id="62" ignoreEDB="1" key="name" xml:space="preserve">I.V.C.</string> //DATA THAT I NEED
                </object>


SECOND INSTANCE


<object idRef="59" key="brand"/> //ONLY A REFERENCE


---------------------------------------------------------------------------

seems to be ok...

but when I simplify the schema using XSLT SimpleTrasformation.xsl I lose objects at all... only first instance is wrote, other have no instance and no references, are completely discarded !

after trasformation:

FIRST ISTANCE:

  <brand>
        <version>5000</version>
        <_EOIntegralKeyGlobalID>
          <entityName>brand</entityName>
          <subEntityName>brand</subEntityName>
          <Integer>
            <value>4</value>
          </Integer>
        </_EOIntegralKeyGlobalID>
        <name>I.V.C.</name>
      </brand> 

SECOND ISTANCE....

.... :(

--------------------------------------------

Please help

Many Thanks
Amedeo


On 28/lug/06, at 16:28, Amedeo Mantica wrote:

Hello, I have two entities

PRODUCTS
BRANDS


PRODUCTS is the entity i need to serialize

PRODUCTS attribbutes  are:
name
genericProduct (a to one relation)
brand (a to one relation)

in product java class I have this

private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException {
NSXMLOutputStream xml_stream = (NSXMLOutputStream)stream;
xml_stream.writeObject(name(),"name");
xml_stream.writeObject(brand(),"brand");
    }

and also in the other entities:

brands:

private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException {
NSXMLOutputStream xml_stream = (NSXMLOutputStream)stream;
xml_stream.writeObject(name(),"name");
    }




when I generate the XML following the methon in Practical WebObjects book i got XML whitout errors... but XML is missing data...

only a few products have brand.name exported
I got only an instance for brand.

(if I have more product with brand.name value set to "A" i got only an object with brand exported, others don't have brand exported)

<product>
<version>
5000
</version>
<EOEditingContext>
<version>
5000
</version>
</EOEditingContext>
<_EOIntegralKeyGlobalID>
<entityName>
product
</entityName>
<subEntityName>
product
</subEntityName>
<Integer>
<value>
1080
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<EOEntityClassDescription>
<entityName>
product
</entityName>
</EOEntityClassDescription>
<name>
Spatola Damascato
</name>
<brand>
<version>
5000
</version>
<_EOIntegralKeyGlobalID>
<entityName>
brand
</entityName>
<subEntityName>
brand
</subEntityName>
<Integer>
<value>
7
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<EOEntityClassDescription>
<entityName>
brand
</entityName>
</EOEntityClassDescription>
<name>
Antica-Signoria BRAND
</name>
</brand>
</product>

<product>
<version>
5000
</version>
<_EOIntegralKeyGlobalID>
<entityName>
product
</entityName>
<subEntityName>
product
</subEntityName>
<Integer>
<value>
4
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<name>
Agua
</name>
<brand>
<version>
5000
</version>
<_EOIntegralKeyGlobalID>
<entityName>
brand
</entityName>
<subEntityName>
brand
</subEntityName>
<Integer>
<value>
4
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<name>
I.V.C. BRAND
</name>
</brand>
</product>

<product>
<version>
5000
</version>
<_EOIntegralKeyGlobalID>
<entityName>
product
</entityName>
<subEntityName>
product
</subEntityName>
<Integer>
<value>
12
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<name>
Astrale
</name>
</product>

<product>
<version>
5000
</version>
<_EOIntegralKeyGlobalID>
<entityName>
product
</entityName>
<subEntityName>
product
</subEntityName>
<Integer>
<value>
13
</value>
</Integer>
</_EOIntegralKeyGlobalID>
<name>
Veronese
</name>
</product>


any suggestion??

Thanks
Amedeo




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to