Hummm forgot something, anyone correct me if i'm wrong but, if you want to
do a list of content, you should write your xml like this :

<content>
<contentDescription><![CDATA[Text here text here.
text here.
text here.]]</contentDescription>
</content>
...

And then my methods will work, because I'm reading all content element and
then I take de contentDescription tag. Anyway I don't know If I helped you
or not LOL

Christian
On Wed, Aug 5, 2009 at 2:46 PM, Christian Goudreau <
[email protected]> wrote:

> You don't have to do it for every node, only those where there is formatted
> text with html tags or carriage return. Simple raw text don't need to be put
> between CDATA.
> In fact, only productDescription of my app got CDATA section, every other
> one is between simple tag like yours.
>
> When you want to write XML from JAVA, it's the only clean way I know.  EX:
> *
>
> public
> *String getObjectXML() {
>
> Document xml = XMLParser.*createDocument*();
>
> Element products = xml.createElement(*PRODUCTSTAG*);
> xml.appendChild(products);
>
> Element product = xml.createElement(
> *PRODUCTTAG*); Element productUID = xml.createElement(
> *PRODUCTUIDTAG*); Text productUIDText = xml.createTextNode(
> *this*.productUID); productUID.appendChild(productUIDText);
> product.appendChild(productUID);
> products.appendChild(product);
> *
>
> return
> *
> xml.toString();
> }
>
> Your XML should be written this way :
>
> <content><![CDATA[Text here text here.
> text here.
> text here.]]
> </content>
> <content><![CDATA[Other text here text here.
> text here.]]
> </content>
>
> EX:  <productDescription><![CDATA[<span style="font-weight: bold;">18
> AWG<br></span>]]></productDescription>
>
> That's what I use in my products XML created dynamically from a MySQL
> database from my PHP servlet.
> Then, tell me what is showed with your code, error etc. Because I see that
> you have a lot of "content" element, so when you do contents.item(0), you
> should have the first one. Is that correct ?
>
> Ohhh and there's is something missing... humm before doing your
> getNodeValue and item(0) Check that :
>
>  Document xmlDoc = XMLParser.*parse*(*this*.response.getText());
> Element root = xmlDoc.getDocumentElement();
> XMLParser.*removeWhitespace*(xmlDoc);
> NodeList objectsNodeList = root.getElementsByTagName(name);
> *for* (Integer i = 0; i < objectsNodeList.getLength(); i++) {
>
> Element objectNode = (Element) objectsNodeList.item(i);
> //HERE you do your contents = element.getElementsByTagName("content");
>
> }
>
> Christian
>
>   On Wed, Aug 5, 2009 at 1:37 PM, Nickelnext <[email protected]> wrote:
>
>>
>> Hello. I tried your way but sure I miss something because it does not
>> work.
>>
>> My application is:
>> ---------------------------------
>> config.xml file
>>
>> <content>Text here text here.
>> text here.
>> text here.
>> </content>
>> <content>Other text here text here.
>> text here.
>> </content>
>>
>> and gwt code
>> HTML contHTML = new HTML();
>> Document d; //where the parser stores the document
>> Element element =  (Element) document.getDocumentElement();
>>
>> //retrieve contents
>> contents = element.getElementsByTagName("content");
>>
>> contHTML.setHTML(contents.item(0).getFirstChild().getNodeValue());
>> ------------------------------
>>
>> now, I know that i must put the <![CDATA[ ]]> around my text, but then
>> i don't understand what to do.
>> Thank you for your help.
>>  >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to