You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by "Sagara Gunathunga (JIRA)" <ji...@apache.org> on 2007/08/23 08:54:30 UTC

[jira] Created: (WODEN-180) XMLElement should provide a method to retrieve its text content.

XMLElement should provide a method to retrieve its text content.
----------------------------------------------------------------

                 Key: WODEN-180
                 URL: https://issues.apache.org/jira/browse/WODEN-180
             Project: Woden
          Issue Type: Improvement
          Components: Parser
            Reporter: Sagara Gunathunga 
            Priority: Minor


XMLElement should provide a method to retrieve its text content.

Currently XMLElement provides methods for retrieving child Elements and attributes. When we have text content inside the XMLElement, there is no way to retrieve it. DocumentationElement is a good example for this, where we add human readable text content.

Because of this deficiency we can't serialize Documentation Element. Wsdl4j facilitates this with the use of org.w3c.dom.Element Interface.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


[jira] Commented: (WODEN-180) XMLElement should provide a method to retrieve its text content.

Posted by "John Kaputin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WODEN-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522559 ] 

John Kaputin commented on WODEN-180:
------------------------------------

XMLElement is just a lightweight abstraction that keeps the Woden API independent of any underlying XML object model and permits some refactoring of common code in classes like BaseWSDLReader.  There may still be times when the underlying XML object model API is required (e.g. DOM or Axiom) and in these cases, knowledge of what to cast to is required (as stated in XMLElement javadoc) and it is documented in the implementation javadoc (DOMXMLElement and OMXMLEmenent).  We can add methods to XMLElement, but note that it is not intended to be a complete abstraction of the DOM and Axiom APIs.

I have some questions about the getTextContent() method proposed for XMLElement.  The <wsdl:documentation> element contains 'mixed type' content. This includes text nodes and child elements, in any combination. What would be the behaviour of getTextContent() and what would it return?  If it returns a String representing everything within the documentation element, then it's acting like a serializer and the method implementation would still need to use the underlying XML object model (e.g. the DOM API)  to get to the text nodes and child elements and serialize them.  This behaviour already exists in DOM2Writer. Is your proposal to move this behaviour from DOM2Writer to the getTextContent() implementation in DOMXMLElement?  If so, perhaps a more generally useful solution would be to have the serializeAsXML method of DOM2Writer on the XMLElement API, with just one parameter - the Writer.

If there is a requirement here to add support for getting element content other than attributes and child elements, then maybe getTextContent() is  not enough. Maybe we need something similar to the DOM concept of accessing the child nodes of an element (which includes attributes, elements, text, comments, etc).  But we need to be careful we don't just end up replicating the DOM and AXIOM APIs. It should be driven by use cases and at the moment we have just one - serialize DocumentationElement.

> XMLElement should provide a method to retrieve its text content.
> ----------------------------------------------------------------
>
>                 Key: WODEN-180
>                 URL: https://issues.apache.org/jira/browse/WODEN-180
>             Project: Woden
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Sagara Gunathunga 
>            Priority: Minor
>
> XMLElement should provide a method to retrieve its text content.
> Currently XMLElement provides methods for retrieving child Elements and attributes. When we have text content inside the XMLElement, there is no way to retrieve it. DocumentationElement is a good example for this, where we add human readable text content.
> Because of this deficiency we can't serialize Documentation Element. Wsdl4j facilitates this with the use of org.w3c.dom.Element Interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


[jira] Commented: (WODEN-180) XMLElement should provide a method to retrieve its text content.

Posted by "Sagara Gunathunga (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WODEN-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522473 ] 

Sagara Gunathunga  commented on WODEN-180:
------------------------------------------

 > You can get the DOM Element representing a wsdl:documentation element via
 > DocumentationElement.getContent() which returns an XMLElement object, then calling     
 > MLElement.getSource() and casting the java.lang.Object to an org.w3c.dom.Element. Will this help with 
 > serialization? 

This approach is worked well and can be used for serialization. Instead of 
Importing org.w3c.dom.Element in to the WSDLWriter, we can hide this logic on DOM2Util class. (And OMUtil). 


 > could you describe the use case in a bit more detail .

At the moment it is possible to retrieve   attributes and child elements through the XMLElement interface without worrying about the underline implementation (DOM or OM). But according to above approach, in order to retrieve text content, it is required to know the specific implementation.

Case 1:  In direct casting approach need to know 
Whether the element is org.w3c.dom.Element or org.apache.axiom.om.OMElement.

Case 2: Assume we have implemented this logic on DOM2Util and OMUtil, still required to know what is the specific implementation (DOM or OM) because no common interface for DOM2Util and OMUtil classes

As a solution, can define getTextContent() method  in   XMLElement interface and can be implemented in DOMXMLElement and OMXMLElement. This will hide the underline implementation from the users. According to my thinking this would be a useful method because Most of the WSDL elements are extended from DocumentableElement



> XMLElement should provide a method to retrieve its text content.
> ----------------------------------------------------------------
>
>                 Key: WODEN-180
>                 URL: https://issues.apache.org/jira/browse/WODEN-180
>             Project: Woden
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Sagara Gunathunga 
>            Priority: Minor
>
> XMLElement should provide a method to retrieve its text content.
> Currently XMLElement provides methods for retrieving child Elements and attributes. When we have text content inside the XMLElement, there is no way to retrieve it. DocumentationElement is a good example for this, where we add human readable text content.
> Because of this deficiency we can't serialize Documentation Element. Wsdl4j facilitates this with the use of org.w3c.dom.Element Interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


[jira] Commented: (WODEN-180) XMLElement should provide a method to retrieve its text content.

Posted by "John Kaputin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WODEN-180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12522447 ] 

John Kaputin commented on WODEN-180:
------------------------------------

You can get the DOM Element representing a wsdl:documentation element via DocumentationElement.getContent() which returns an XMLElement object, then calling XMLElement.getSource() and casting the java.lang.Object to an org.w3c.dom.Element. Will this help with serialization?  

XMLElement is an abstraction that hides the choice of underlying XML object model (e.g. DOM or Axiom) from the Woden API. The methods on XMLElement are mostly those that existed on DOMUtils in WSDL4J.  DOMUtils did not have any methods for handling text or mixed type content. It's possible to add methods for mixed type to XMLElement if you need this, but could you describe the use case in a bit more detail (i.e. how you intend to serialize the documentation element using the new method(s) ).

> XMLElement should provide a method to retrieve its text content.
> ----------------------------------------------------------------
>
>                 Key: WODEN-180
>                 URL: https://issues.apache.org/jira/browse/WODEN-180
>             Project: Woden
>          Issue Type: Improvement
>          Components: Parser
>            Reporter: Sagara Gunathunga 
>            Priority: Minor
>
> XMLElement should provide a method to retrieve its text content.
> Currently XMLElement provides methods for retrieving child Elements and attributes. When we have text content inside the XMLElement, there is no way to retrieve it. DocumentationElement is a good example for this, where we add human readable text content.
> Because of this deficiency we can't serialize Documentation Element. Wsdl4j facilitates this with the use of org.w3c.dom.Element Interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org