cancel
Showing results for 
Search instead for 
Did you mean: 

Read XML Form source

Former Member
0 Kudos

Hello all,

I'm trying to programaticaly read the contents of an XML Form. I get my resource, grab it's content, get an input stream and start reading. The problem is that instead of a simple XML file being read, what comes back is an entire HTML page with all the layout for the list viewer form, not the XML source.

The code that I'm using is below, I know that it's bad but this is just a test program so it doesn't matter.

StringBuffer sb = new StringBuffer();
IResource res = ....;// Here I get my resource
try{
  IContent con = res.getContent();
  try{
    InputStream is = con.getInputStream();
    int c;
    while((c = is.read())!=-1){
      sb.append((char)c);
    }
    scrollingText = addToText(scrollingText, sb.toString()+"<br>");
  }catch(ContentException e){
  }catch(IOException e){
  }
}catch(ResourceException rE){
}

So is it possible to access the XML source so that I can read values of specific elements? How?

Regards,

Patrick.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Patrick,

Please check out my reply in this thread :

Basically you need to use getUnfilteredContent() instead of getContent(), so that the XML doesn't get formatted by the resource filter.

Former Member
0 Kudos

Thanks Olivier.

Regards,

Patrick.

Answers (0)