users@jaxb.java.net

RE: Re: Compute xs:any and xs:attribute

From: Lulseged Zerfu <lulseged.zerfu_at_ericsson.com>
Date: Thu, 10 Dec 2009 16:53:24 +0100

Hi
 Thanks

 What I mean was to separate xs:any and xs:attribute from the document
with the namespaces defining them.

 An example is:

 <?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
xmlns:ou="urn:oma:xml:xdm:resource-list:oma-uriusage"
        xmlns:oxe="urn:oma:xml:xdm:extensions"
xmlns:oga="urn:oma:xml:poc:group-advertisement"
xmlns:opu="urn:oma:xml:poc:oma-pocusage"
        xmlns:oiu="urn:oma:xml:im:oma-imusage">
        <list name="bookmarkedGroups">
                <entry uri="sip:group1_joebloggs_at_example.com">
                        <display-name>Joe Bloggs's golf
team</display-name>
                        <ou:uriusages>
                                <oxe:common-usage id="a1">
                                        <oga:group-advertisement>
                                                <oga:note>This group
will meet next week</oga:note>
                                                <oga:group
type="dialed-in">
 
<oga:display-name>Joe Bloggs's golf team</oga:display-name>
 
<oga:uri>sip:group1_joebloggs_at_example.com</oga:uri>
 
<oxe:group-media>
 
<oxe:all-media-except>
 
<oxe:file-transfer />
 
</oxe:all-media-except>
 
</oxe:group-media>
 
<oxe:supported-services>
 
<oxe:service enabler="poc" />
 
<oxe:service enabler="im" />
 
</oxe:supported-services>
                                                </oga:group>
                                        </oga:group-advertisement>
                                </oxe:common-usage>
                                <opu:pocusage>chat</opu:pocusage>
                                <oiu:imusage>chat</oiu:imusage>
                        </ou:uriusages>
                </entry>
                <entry uri="sip:group1_bob_at_example.com">
                        <display-name>Bob's ski friends</display-name>
                        <ou:uriusages>
                                <opu:pocusage>prearranged</opu:pocusage>
                        </ou:uriusages>
                </entry>
        </list>
</resource-lists>

 
 
The red part is not defined by the default namespace
(urn:ietf:params:xml:ns:resource-lists).

If I separate this document I get one document which is defined by a
known namespace:

<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists" >
        <list name="bookmarkedGroups">
                <entry uri="sip:group1_joebloggs_at_example.com">
                        <display-name>Joe Bloggs's golf
team</display-name>
                </entry>
                <entry uri="sip:group1_bob_at_example.com">
                        <display-name>Bob's ski friends</display-name>
                </entry>
        </list>
</resource-lists>

The red parts will be computed as follows with the name spaces defining
it:

This document will be saved in a structured way. (Relational database)

<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
xmlns:ou="urn:oma:xml:xdm:resource-list:oma-uriusage"
        xmlns:oxe="urn:oma:xml:xdm:extensions"
xmlns:oga="urn:oma:xml:poc:group-advertisement"
xmlns:opu="urn:oma:xml:poc:oma-pocusage"
        xmlns:oiu="urn:oma:xml:im:oma-imusage">
<ou:uriusages>
    <oxe:common-usage id="a1">
        <oga:group-advertisement>
             <oga:note>This group will meet next week</oga:note>
             <oga:group type="dialed-in">
                 <oga:display-name>Joe Bloggs's golf
team</oga:display-name>
                 <oga:uri>sip:group1_joebloggs_at_example.com</oga:uri>
                 <oxe:group-media>
                     <oxe:all-media-except>
                         <oxe:file-transfer />
                     </oxe:all-media-except>
                 </oxe:group-media>
                 <oxe:supported-services>
                     <oxe:service enabler="poc" />
                     <oxe:service enabler="im" />
                 </oxe:supported-services>
             </oga:group>
        </oga:group-advertisement>
    </oxe:common-usage>
    <opu:pocusage>chat</opu:pocusage>
    <oiu:imusage>chat</oiu:imusage>
</ou:uriusages>
</resource-lists>


 
<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
xmlns:ou="urn:oma:xml:xdm:resource-list:oma-uriusage">
    <ou:uriusages>
        <opu:pocusage>prearranged</opu:pocusage>
    </ou:uriusages>
</resource-lists>

 
These two documents will be saved in a database as CLOB/BLOB.
 
When returning the whole document, all these fragments will be put
togther by my application.
 
But my problem is how to compute/separate, put the name spaces needed
for these 2 documents.
 
Lulseged


-----Original Message-----
From: aleksei.valikov_at_gmail.com [mailto:aleksei.valikov_at_gmail.com] On
Behalf Of Aleksei Valikov
Sent: den 10 december 2009 16:02
To: users_at_jaxb.dev.java.net
Subject: Re: Compute xs:any and xs:attribute

Hi,

> I am saving xml documents structured in a relational database. But it
> will not work if the schema defining the xml document contains xs:any
> or xs:anyAttribute.
>
> Is there anyway where I can compute xs:any or xs:attribute and its
> namespace separatly?

What do you mean by "compute separately"?

> I am not going to parse these xs:any or xs:attribute in my application
> but need to return back when asked by an external application which
> created these xs:any and xs:attribute types.

Well, you have to store them somewhere. Consider storing @XmlAnyElement
as BLOB/CLOB in the database and @XmlAnyAttribute as string/string map.

> This will help me to save the xs:any or xs:attribute types as they
> are together with the namespaces defined in a model and the rest of
> the xml document will be modeled i a relational database.

ps. Are you aware of Hyperjaxb3?
See http://confluence.highsource.org/display/HJ3/Home

Bye.
/lexi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net