You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-dev@xml.apache.org by Aleksander Slominski <as...@cs.indiana.edu> on 2004/04/30 00:03:10 UTC

converting views: DOM, XmlCursor, XmlNode, ... [Re: compile time generation of XmlElement//Attribute for interface types [Re: XmlObject and XML Infoset

Eric Vasilik wrote:

>Yes, I would add a static method somewhere which would allow you to
>convert among the various views.
>  
>
so how difficult it is to generalize it to support multiple view and 
switching between them through controller like:

XmlObject.castOrWrap(Object o, Class targetInterface);

for example

PurchaseOrderElement po = (PurchaseOrderElement) XmlObject.castOrWrap(Node node, PurchaseOrderElement.class);

alek

ps. in JDK 1.5 i think it can be somewhat shortahnded to avoid casting:
PurchaseOrderElement po = XmlObject.castOrWrap<PurchaseOrderElement>(Node node);


>  
>
>>-----Original Message-----
>>From: David Remy
>>Sent: Thursday, April 29, 2004 8:51 AM
>>To: xmlbeans-dev@xml.apache.org
>>Subject: RE: compile time generation of XmlElement//Attribute for
>>interface types [Re: XmlObject and XML Infoset
>>
>><snip>
>>    
>>
>>>>how will you be able to switch between different views i.e. in case
>>>>when i have DOM Element how i can find XmlObject view on it? can i
>>>>dynamically for an unbound DOM element bound it (convert) to XML
>>>>Schema derived Foo type? in other words can i start with DOM
>>>>(Infoset?) and rebind parts of it to XmlBeans?
>>>>        
>>>>
>>>Yes, as long as the DOM element is one which I created.  If
>>>you want to
>>>take, for example, a Xerces DOM element and get an XmlObject
>>>on it, you
>>>would have to import that element.  However, I will provide ways to
>>>convert among the various views with out additional overhead.
>>>      
>>>
>>Eric, have you thought about how this conversion between
>>the different xmlbean views would look?  Like, say you have a DOM
>>Node in hand, how will you get an XmlObject or XmlCursor on it?  Or
>>any other combination? I guess it will have to be thru some sort of
>>static like Public?  Something like:
>>
>>XmlObject getXmlObject(Node node);
>>
>>?
>>
>>    
>>
>>>>thanks,
>>>>
>>>>alek
>>>>
>>>>--
>>>>        
>>>>
>>-
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
>>For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
>>Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>>    
>>
>
>
>- ---------------------------------------------------------------------
>To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
>Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>
>
>  
>


-- 
The best way to predict the future is to invent it - Alan Kay


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/