Reading a file with UTF-8 contents
Hi,
I am not sure whether this is the right forum for my question. If not, please tell me.
I have a problem reading a file where some characters are stored in UTF-8. An example string from the file is: "M\u00f6hrchen"
But If I read this in, with a BufferedReader this becomes "M\\u00f6hrchen". Why is this so?
The code is the following:
BufferedReader reader= new BufferedReader(
new InputStreamReader(
new FileInputStream(filename, "UTF-8"));
while (reader.ready()) {
String line= reader.readLine();
}Any hints what is going wrong? It must be something with the input stream, since writing the String directly into the code works.
Marco
First - "\u00f6" isn't UTF-8 encoding; it's a unicode
escape sequence.
UTF-8 encoding would mean that your character is
actually stored as a single unicde character - not 6
ascii characters.Oh, than I misunderstood this.
Second, just do:
BufferedReader reader= new BufferedReader(
new InputStreamReader(
new
new
new FileInputStream(filename));
while (reader.ready()) {
String line= reader.readLine();
I tried this along with other encodings. Nothing worked correctly. The output of specifiying UTF-8 and nothing is the same. Java seems to not understand that this is a unicode escape sequence, but rather escapes the backslash.
Similar Messages
-
Can you add to the Lightroom an ability to process several raw files with the same content but with different exposure into the single picture?
Base raw files can be given with exposure bracketing during shooting, for example.
The goal - to get maximum details in darks and lights (if we use the "ligths recovery" or "fill lights" we lose the quality because raw file just have no all required information).
The similar (but not the same, only the idea) thing - is High Dynamic Range Photography in Adobe Photoshop
Thank youThe plugin LR/Enfuse does this already. And of course Photomatix have a plugin available for Lightroom. This essentially amounts to pixel editing, which is beyond the range of Lightroom's metadata editing.
-
Problems with reading XML files with ISO-8859-1 encoding
Hi!
I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
Here's the code:
import java.io.File;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.net.*;
* @author gustav
public class RSSDocument {
/** Creates a new instance of RSSDocument */
public RSSDocument(String inurl) {
String url = new String(inurl);
try{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(url);
NodeList nodes = doc.getElementsByTagName("item");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
System.out.println("Title: " + getCharacterDataFromElement(line));
NodeList des = element.getElementsByTagName("description");
line = (Element) des.item(0);
System.out.println("Des: " + getCharacterDataFromElement(line));
} catch (Exception e) {
e.printStackTrace();
public String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
return "?";
}And here's the error message:
org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at getrss.RSSDocument.<init>(RSSDocument.java:25)
at getrss.Main.main(Main.java:25)I read files from the web, but there is a XML tag
with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s). -
Reading large file with JCA Adapter in OSB
Hello,
We are searching for a solution how to read large file (>50M) from network drive and deliver it to queue via OSB 11gR4 (10.3.4). The problem is when reading the file with JCA File Adapter. It seems that it cannot handle as large files as we have. The documentation provides a way to bypass file size limitation by using Chunk Read but it seems to require BPEL Process execution which is not possible in our environment. Does anyone know if there are ways to implement this without having BPEL Process?
Our usecase:
read file from network drive -> transfer with OSB -> deliver MQ
Other options than JCA File Adapter can be considered, if anyone can advice...If it's a plain routing use case and no message processing is required then you may simply use OSB's FILE transport instead of JCA adapter. Create a messaging type proxy service and select request message type as "binary". Also enable the content streaming (Disk buffer, compression).
From OSB Dev guide -
Oracle JCA Adapter for FTP and Files – Attachments (large payload support), pre- and post-processing of files, using a re-entrant valve for processing ZIP files, content streaming, and file chunked read are not supported with Oracle Service Bus.
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/jca.htm#BABBICIA
You may also refer -
Reading huge flat file in OSB 11gR1
Regards,
Anuj -
I have a question, but I posted it on the wrong forum. This is the link:
https://social.msdn.microsoft.com/Forums/en-US/899c8291-70f5-4c1b-abf2-a1a1242e017a/read-xml-file-with-counter?forum=visualstudiogeneral&prof=requiredHi,
I have created a program that read an xml file like this:
<xas>
<information>
<list>"12345"</list>
<version>1.0.0.1</version>
</information>
<word><n>0</n><v>test123v</v><a>test123a</a></word>
<word><n>1</n><v>testv</v><a>testa</a></word>
</xas>
I read it to a listview called listview1:
The MainWindow.xaml:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="1220" Width="1017" WindowStartupLocation="Manual" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.CanContentScroll="True" UseLayoutRounding="False" WindowState="Maximized">
<Grid>
<ListView x:Name="ListView1" HorizontalAlignment="Left" Height="1220" VerticalAlignment="Top" Width="1017">
<ListView.View>
<GridView x:Name="Lijst">
<GridViewColumn x:Name="Vraag" Header="Vraag" DisplayMemberBinding="{Binding Vraag}">
</GridViewColumn>
<GridViewColumn x:Name="Antwoord" Header="Antwoord" DisplayMemberBinding="{Binding Antwoord}">
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
And this is MainWindow.xaml.vb:
Imports System.IO
Imports System.Reflection.Assembly
Imports System.Xml
Imports System.Data
Class MainWindow
Dim VraagListBox As New ListBox
Dim AntwoordListBox As New ListBox
Dim Hoofdmap As String = GetExecutingAssembly().Location
Dim Bestand As String
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
'RUNNEN MAAR!!!!
'Het bestand vinden in de commandline argumenten
Dim args() As String = System.Environment.GetCommandLineArgs()
Dim Teller As Integer = "0"
For Each arg As String In args
If Teller = "1" Then
Bestand = arg
Else
Teller = Teller + "1"
End If
Next
Bestand = "D:\Alles voor school!\Alles voor school!\Vakken\Stepping Stones\DATA1\Hoofdstuk 1\Leerlijsten\Hoofdstuk 1 Grammer 1.xas"
'Welk bestand? Set de title
Me.Title = Path.GetFileName(Bestand) & " - ListViewer (V.1.0.0.6)"
If Bestand <> "" Then
'Vragen en antwoorden toevoegen in de kolommen
If Path.GetExtension(Bestand) = ".xas" Then
Dim orderInfo = XElement.Load(Bestand)
For Each entry As XElement In orderInfo...<word>
Dim thisOrder As New Order
With thisOrder
.Vraag = entry...<v>.Value
.Antwoord = entry...<a>.Value
End With
ListView1.Items.Add(thisOrder)
Next
'Virtuele vraaglistbox toevoegen = kolom Vraag van LisView1
Dim orderInfoVraag = XElement.Load(Bestand)
For Each entry As XElement In orderInfoVraag...<word>
Dim thisOrderVraag As New VraagClass
With thisOrderVraag
.Vraag = entry...<v>.Value
End With
VraagListBox.Items.Add(thisOrderVraag)
Next
'Virtuele antwoordlistbox toevoegen = kolom Antwoord van LisView1
Dim orderInfoAntwoord = XElement.Load(Bestand)
For Each entry As XElement In orderInfoAntwoord...<word>
Dim thisOrderAntwoord As New AntwoordClass
With thisOrderAntwoord
.Antwoord = entry...<a>.Value
End With
AntwoordListBox.Items.Add(thisOrderAntwoord)
Next
'Check wat er fout is aan het bestand, en geef een melding
Else
MessageBox.Show("Er is een verkeerde extentie geselecteerd, namelijk: " & Path.GetExtension(Bestand) & ".", "Verkeerde extentie - ListViewer", MessageBoxButton.OK, MessageBoxImage.Error)
Me.Close()
End If
Else
If Bestand = "" Then
MessageBox.Show("Je hebt geen bestand geselecteerd", "Geen bestand geselecteerd - ListViewer", MessageBoxButton.OK, MessageBoxImage.Error)
Me.Close()
Else
MessageBox.Show("Er is iets misgegaan met het laden van het bestand, probeer het later opnieuw", "Onbekende error - ListViewer", MessageBoxButton.OK, MessageBoxImage.Error)
Me.Close()
End If
End If
End Sub
Private Sub ListView1_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles ListView1.MouseDoubleClick
Directory.CreateDirectory(Path.GetTempPath & "110% Soft\ListViewer 1.0.0.6\" & Path.GetFileName(Bestand))
Dim SchrijfVraag As New StreamWriter(Path.GetTempPath & "110% Soft\ListViewer 1.0.0.6\Word.txt")
Dim SchrijfFile As New StreamWriter(Path.GetTempPath & "110% Soft\ListViewer 1.0.0.6\File.txt")
SchrijfVraag.WriteLine(ListView1.SelectedIndex)
SchrijfFile.WriteLine(Bestand)
SchrijfVraag.Close()
SchrijfFile.Close()
Dim WoordenScherm As ViewWord
WoordenScherm = New ViewWord()
WoordenScherm.ShowDialog()
End Sub
End Class
ViewWord.xaml is:
<Window x:Class="ViewWord"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ViewWord" Height="155" Width="1017" ResizeMode="NoResize" SizeToContent="WidthAndHeight" Topmost="True" WindowStartupLocation="CenterScreen">
<Grid>
<Label x:Name="VraagLabel" Content="Vraag:" HorizontalAlignment="Left" Margin="23,11,0,0" VerticalAlignment="Top" Width="106"/>
<TextBox x:Name="VraagTextBox" HorizontalAlignment="Left" Height="24" Margin="134,13,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="743" />
<Label x:Name="AntwoordLabel" Content="Antwoord:" HorizontalAlignment="Left" Margin="23,42,0,0" VerticalAlignment="Top" Width="106"/>
<TextBox x:Name="AntwoordTextBox" HorizontalAlignment="Left" Height="24" Margin="134,44,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="743"/>
<Button x:Name="VraagAanpassenButton" Content="Aanpassen" HorizontalAlignment="Left" Margin="882,15,0,0" VerticalAlignment="Top" Width="107"/>
<Button x:Name="AntwoordAanpassenButton" Content="Aanpassen" HorizontalAlignment="Left" Margin="882,44,0,0" VerticalAlignment="Top" Width="107"/>
<Label x:Name="VraagNummerLabel" Content="Vraagnummer:" HorizontalAlignment="Left" Margin="23,72,0,0" VerticalAlignment="Top" Width="106"/>
<TextBox x:Name="VraagNummerTextBox" HorizontalAlignment="Left" Height="24" Margin="134,74,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="743"/>
<Button x:Name="VraagNummerAanpassenButton" Content="Aanpassen" HorizontalAlignment="Left" Margin="882,74,0,0" VerticalAlignment="Top" Width="107"/>
</Grid>
</Window>
In VraagTextBox must come the entry <word><v>test123v</v></word>, in AntwoordTextBox must come the entry <word><a>test123a</a></word>, and in VraagNummerTextBox must come the entry <word><n>0</n></word>
This is the code to fix that (ViewWord.xaml.vb):
Imports System.IO
Public Class ViewWord
Private Structure AntwoordVraag
Public Vraag As String
Public Antwoord As String
End Structure
Private Sub ViewWord_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
End Sub
Private Sub AntwoordAanpassenButton_Click(sender As Object, e As RoutedEventArgs) Handles AntwoordAanpassenButton.Click
Dim Vraagnummer As String
Dim Bestandsnaam As String
Dim LeesVraag As New StreamReader(Path.GetTempPath & "110% Soft\ListViewer 1.0.0.6\Word.txt")
Dim LeesFile As New StreamReader(Path.GetTempPath & "110% Soft\ListViewer 1.0.0.6\File.txt")
Vraagnummer = LeesVraag.ReadLine()
Bestandsnaam = LeesFile.ReadLine()
LeesVraag.Close()
LeesFile.Close()
MessageBox.Show(Vraagnummer)
Dim teller As Integer = 0
Dim orderInfo = XElement.Load(Bestandsnaam)
If teller = Vraagnummer Then
VraagNummerTextBox.Text = orderInfo...<word>...<n>.Value
VraagTextBox.Text = orderInfo...<word>...<v>.Value
AntwoordTextBox.Text = orderInfo...<word>...<a>.Value
Else
teller = teller + 1
End If
End Sub
End Class
But the result isn't:
VraagTextBox.Text = testv
AntwoordTextBox.Text = testa
NummerTextBox.Text = 1
if i click on the number 2 of the listview (index = 1)
How can i fix it? -
I can't read a file with the ext PDF the sender informed me that the file was reset to PDF.
I can't read a file with the .ext PDF the sender informed me that the file was reset to PDF. But when I tried to open it the caption box informed me"the file is not in PDF format. I suspect the sender simply changed the file .ext which is why I can't open it! What can I do about it! I am working on an iPad.
Thanks
Mr Jim LapthornIf the document is not, in fact, a PDF, then you will need to get your sender to provide a PDF.
Can you open this document in any other application? -
Revision: 7661
Author: [email protected]
Date: 2009-06-08 17:50:12 -0700 (Mon, 08 Jun 2009)
Log Message:
Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.
QA Notes:
Doc Notes:
Bugs: SDK-21636
Reviewers: Corey
Ticket Links:
http://bugs.adobe.com/jira/browse/iso-8859
http://bugs.adobe.com/jira/browse/utf-8
http://bugs.adobe.com/jira/browse/utf-8
http://bugs.adobe.com/jira/browse/SDK-21636
Modified Paths:
flex/sdk/trunk/templates/swfobject/index.template.htmlsame problem here with wl8.1
have you sold it and if yes, how?
thanks -
I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?
By doing a Google search.
-
Read a file with a variable=counter : NAMEFILE001,NAMEFILE002..
Hello,
I would need your councils.
I can read a logical file on my server(logical example of name: NAMEFILE) with function FILE_GET_NAME.
But I would like to be able to read a file with a counter i.e.
the first time: to read NAMEFILE001;
the second time read NAMEFILE002;
the third time read NAMEFILER003...
How made you that?
With function FILENAME_EXIT _?
But, where do I put the variable = counter? In a table...?
Thank you in advance of your answer
ServaneHi Servane,
You could also do the following:
in transaction FILE you set up the physical path name as follows:
/<i>path</i>/.../<FILENAME><PARAM_1>
then you call the function FILE_GET_NAME:
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = W_LOGICAL_FILENAME
PARAMETER_1 = W_FILENUMBER
IMPORTING
FILE_NAME = THEFILE
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
This will equally construct the name/counter as you wish.
AND, if I am not wrong, since the system does it, you will not have to worry about putting the last counter value away in the DB.
cheers,
Phil
Message was edited by: Phillip Morgan -
Read multiples files with same extension
how to read multiples files with same extension in java.
for ex : i would like to read all .DAT files from C drive using java.
How is it done- You create the filter
- You get the list of files
- You open and read each file.
For the first two above you look at java.io.File and listFiles(FileFilter filter).
For the third you find whatever input stream is appropriate from java.io.* -
Why can't I read PDF files with this browser?
It says "can't read PDF files with this browser running. Exit and try again."
I have Adobe 9.3.2 installed. It didn't give me this message with earlier versions of Adobe.
Is there a way to go BACKWARDS?
How do I save the PDF files so I can close them and view them without using the browser?
== I downloaded later versions of Adobe.I have tried everything,Foxit and Foxit updates, Gone to Adobe......you think of it I have tried.
ONLY ANSWER THAT WORKS :
Download Internet Explorer 8 and use that -
Hi Folks,
How to read & write files with same extension(like ".sas", ".txt" , ".csv",and ".log" in Adobe AIR.
Please let me tell if anybody knows asap.
Thanks & Regards,
AndersonThanks Jon,
But, I know how to read the file if we give exact file path
I need to get the path and read file(s) with same extension files in the same folder using adobe air, not single file.
Don't have file path even, i have folder path, in that somany files are there. So i need to get which are the same extension(Ex: ".txt", ".sas") files
If you have any idea , please help me out
Regards,
Vijay. -
hello all,
I've this XML file:
<?xml version="1.0" standalone="yes"?>
<Configurations>
<PageConfigurations softwareCode="63720415" softwareVersion="07" />
<Page pageName="PAGE1">
<description>DESC1</description>
<Param>
<name>TaskMulti_guc</name>
<address>1128203</address>
<nameType>C</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
<Param>
<name>TempNum_guh</name>
<address>1124743</address>
<nameType>H</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
<Param>
<name>vMylifeSignal_guc</name>
<address>1131388</address>
<nameType>C</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
</Page>
<Page pageName="PAGE2">
<description>DESC2</description>
<Param>
<name>TaskMulti_guc</name>
<address>1128203</address>
<nameType>C</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
<Param>
<name>TaskMulti_guc</name>
<address>1128203</address>
<nameType>C</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
</Page>
<Page pageName="PAGE3">
<description>DESC3</description>
<Param>
<name>TaskMulti_guc</name>
<address>1128203</address>
<nameType>C</nameType>
<size>1</size>
<offset>0</offset>
<format>Hexadecimal</format>
<description>description</description>
<adminReadonly>false</adminReadonly>
<userReadonly>true</userReadonly>
<byteNumber>4</byteNumber>
<gainK1>1</gainK1>
<gainK2>1</gainK2>
<offsetScale>0</offsetScale>
<switchName />
<switchAddress />
<switchType />
<switchSize>1</switchSize>
<switchOffset>0</switchOffset>
<switchByteNumber>4</switchByteNumber>
<switchValue>0</switchValue>
<switchTime>Before</switchTime>
<switchReset>false</switchReset>
<debugName />
<debugAddress />
<debugType />
<debugSize>1</debugSize>
<debugOffset>0</debugOffset>
</Param>
</Page>
</Configurations>
with this class:
public class Page
public string PageName { get; set; }
public string Description { get; set; }
public List<Param> List = new List<Param>();
public class Param
public string Name { get; set; }
public string Address { get; set; }
public string Format { get; set; }
public string Description { get; set; }
How can I read this file with LINQ (I'm no expert) for fill correctly my object ?
Thanks in advance.
StefanoPlease refer to the following sample code:
XDocument doc = XDocument.Load("c:\data1.xml");
List<Page> pages = new List<Page>();
var pageElems = doc.Root.Elements("Page");
foreach (var page in pageElems)
Page pageObj = new Page();
pageObj.PageName = page.Attribute("pageName").Value;
pageObj.Description = page.Element("description").Value;
pageObj.List = new List<Param>();
var paramElems = page.Elements("Param");
foreach(var paramElem in paramElems)
Param paramObj = new Param();
paramObj.Address = paramElem.Element("address").Value;
paramObj.Description = paramElem.Element("description").Value;
pageObj.List.Add(paramObj);
pages.Add(pageObj);
The code adds the Page objects to the pages list.
Please remember to close your threads by marking all helpful posts as answer and then start a new thread if you have a new question. -
Can we read Money files with iCompta?
Can we read Money files with iCompta?
Yes and no. I f you mean reading multiple files as one-single-payload to a process, you can not use this. But the file adapter reads all the files (depending on the number of agents) almost at once, processing each file, or each line in the file as a process instance.
Marc -
Is Adobe reader touch for windows 8 support interactive PDF files with multi media contents like SWF
I have many PDF files with SWF content i try Adobe reader X but it is slow, so i try Adobe reader touch for windows 8 but the SWF doesn't work.
The full featured Reader for Windows 8 is Reader XI.
Reader Touch works in all Windows 8 systems BUT it is intended mainly for use in mobile tablets - I see no particular reason to use it unless you can'r run Reader XI. Given it is mainly for use on mobile that can't use Flash, we aren't likely to ever see the development team spending their time on this.
If you want the latest and greatest - at least try Reader XI, not X! (Flash is a separate download, it will prompt).
Maybe you are looking for
-
Get date from portal in a web dynpro?
hi all, how get date from portal in a web dynpro??? thanks.
-
Need help uninstalling Acrobat 9.0 Pro (including registry entries)
Hello; I installed Acrobat Pro 9.0 and am not happy with it and want to COMPLETELY uninstall it. I was able to uninstall it using Add/Remove Programs, but I can see that there are still some left-over registry entries related to Adobe Acrobat 9 (this
-
Workflows : Multiline Container Element problem.
Hi, I got a new problem. Well I got a requirement to collect <b>COMMENTS</b> from <i>MULTI-LEVEL Supervisors</i> and display them in the <i>work item preview</i>. So in these regards, I had declared a Multiline Container element in my Workflow and pa
-
Excel File Management Apache POI HSSF vs. jxl jar
I've been reviewing Java technologies for managing Excel files, and I'm a little confused about the differences between Apache's POI HSSF implementation and JExcelApi, and utimately what technology it makes sense to use. They are both open source, al
-
Dear expert, in iw31/iw32 I want to validate plant section field under location tab with recipient field in component tab.that means when user create order with material he will enter recipient as a plant section . & if this two field are not equal r