Statique load of XML file with List choose
Hi,
So let me explain my problem:
- I have some XML files: (in my <fx:Declaration>)
<fx:XML id="flexang" source="xml/flex-ang.xml" />
<fx:XML id="flexastro" source="xml/flex-astro.xml" />
<fx:XML id="flexber" source="xml/flex-ber.xml" />
- I have a List constructed as follows:
(in my <fx:Declaration>)
<fx:Model id="anim">
<states>
<state label="Anguinéa" data="animations/flex-ang.swf"/>
<state label="Mouvement rétrograde" data="animations/flex-astro.swf"/>
<state label="Bielle de Bérard" data="animations/flex-ber.swf"/>
</states>
</fx:Model>
(and then)
<mx:List id="source" width="100%" color="blue"
dataProvider="{anim.state}"
change="selectedListItem = List(event.currentTarget).selectedItem;"/>
(with public var selectedListItem:Object;)
My List is built to load dynamicaly some SWF files
<mx:SWFLoader id="animation"
source="{selectedListItem.data}"
autoLoad="true"
width="100%"/>
- But now I want to display the corresponding. So I tried to contruct the String of the XML id from the selectedListItem.data:
private function xmlFile(swf:String):String
var pref:String;
var tab=swf.split(".",2);
tab=tab[0].split("/",2);
pref=tab[1];
pref=pref.split("-").join("");
return pref;
This gives me, for example, "flexang" from "animations/flex-ang.swf". But my problem is that I want to put my XML file in my RichText area:
<s:RichEditableText id="codeView" editable="false" textFlow="{TextFlowUtil.importFromXML(xmlFile(selectedListItem.data))}" />
But xmlFile returns a String! and I do not know how to specify that it is a XML id.
I hope I am clear enough.
Thanks if you try to help me
Wait that wasn't right. Try:
TextFlow="{TextFlowUtil.importFromXML(this[xmlFile(selectedListItem.data)])}
Similar Messages
-
Hi,
I would like to load a xml file with the xml.loader action block.
The name of the file is 78b39221#11b6f.
When i test the transaction i get the error:
[ERROR]: Unable to complete requested action on XML document. c:\Inetpub\wwwroot\Test\78b39221 (The system cannot find the file specified)
How can I manage it to load the file?Torben,
I guess you are working with MII 11.5?
I have just tried it with MII 12.0, saved a XML file with the same name you have mentioned in a WEB folder, and the XML Loader could input the file, no matter if the ".xml" extension was included or not. The xml structure and contents have been read correctly.
Maybe this is a version 11.5 problem, that the suffix "#..." is cut off from the filename so MII could not find the file?
Michael -
Loading xml file with multiple rows
I am loading data from xml files using xsl for transformation. I have created xsl's and loaded some of the data. In an xml file with multiple row, it's only loading one (the first) row. Any idea how I can get it to read and load all the records in the file???
Could some please help me with the above. I desparately need to move forward.
-
Loading XML file with missing elements dynamically through ODI
Hi Guys ,
I have the below xml file with two nodes Employee and Address. On a daily basis , sometimes the address element might not come in from the source xml file , but my interface has columns mapped to address elements, and hence it can fail due to the source element not being found in the file or data might not get loaded due to the 'and' condition in the sql query generated between the employee and address elements. Is there a way where i can load the data dynamically where i can search in the file only for the elements (Employee) present and load data only for those elements dynamically?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Thanks ,
Revanth TambisettyI was able to resolve it by using left outer joins and referring the table structure from the XSD
-
Failed to load XML file with Content ID 'XYZ'
Hello,
We are using UCM Version:11.1.1.8.1DEV-2014-01-06 04:18:30Z-r114490 (Build:7.3.5.185) with site studio for creating templates and web sites.
While switching to contribution mode, we find 'Failed to load XML file with Content ID 'XYZ' error.[Here XYZ is the local checkin content]
In region we are using dynamic converter to convert the style of native document here below are region and its element details.
<region id="region3" name="Add_Content_Here" flags="1111111100100" metadata="xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue" dccommand="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')">
<!--$region3_ACTIONS="EIMPRS",region3_DCCOMMAND="ssIncDynamicConversionByRule(SS_DATAFILE, 'Colleges_Template_Rule')" -->
<element id="region3_element1" name="Editor" label="Editor" type="1" flags="111111111111111111111100000111100000000000001111001110111010001111101000000000000000000000000000">
<!--$region3_element1="Add_Content_Here/Editor" -->
<linktoregioncontent createnewxml="true" createnewnative="false" choosemanaged="true" chooselocal="false" choosenone="false">
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
</linktoregioncontent>
</element>
<switchregioncontent createnewxml="true" createnewnative="true" choosemanaged="true" chooselocal="false" choosenone="false">
<createnewnativedoctypes >
<![CDATA[.doc,.docx,.txt,.rtf]]>
</createnewnativedoctypes>
<choosemanagedquerytext corecontentonly="FALSE">
<![CDATA[xWebsiteObjectType <Matches> `Data File` <OR> xWebsiteObjectType <Matches> `Native Document`]]>
</choosemanagedquerytext>
<defaultmetadata >
<![CDATA[xIdcProfile%3AisHidden%3Dtrue%26xTemplateType%3AisHidden%3Dtrue%26xCollegesList%3AisHidden%3Dtrue%26xShowInStudents%3AisHidden%3Dtrue%26xShowInStaff%3AisHidden%3Dtrue%26xShowInVisitors%3AisHidden%3Dtrue%26xShowInFaculty%3AisHidden%3Dtrue%26xArticleSection%3AisHidden%3Dtrue%26xDiscussionCount%3AisHidden%3Dtrue%26xDiscussionType%3AisHidden%3Dtrue%26dpTriggerValue%3DCSE]]>
</defaultmetadata>
</switchregioncontent>
</region>
<!--SS_BEGIN_OPENREGIONMARKER(region3)--><!--$SS_REGIONID="region3"--><!--$include ss_open_region_definition --><!--SS_END_OPENREGIONMARKER(region3)-->
<!--SS_BEGIN_ELEMENT(region3_element1)--><!--$ssIncludeXml(SS_DATAFILE,region3_element1 & "/node()")--><!--SS_END_ELEMENT(region3_element1)-->
<!--SS_BEGIN_CLOSEREGIONMARKER(region3)--><!--$include ss_close_region_definition --><!--SS_END_CLOSEREGIONMARKER(region3)-->
Regardrs,
SyedHi Syed ,
Add the following trace sections :
requestaudit,sitestudio*,system + Full verbose tracing
Clear the server output .
Replicate the same steps and once error shows up , refresh server output and copy the logs to a text file and upload here .
Thanks,
Srinath -
Hi all experts,
I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
is there anyone know why
SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
2 /
SQL> set long 10000 pages 200 lines 150
SQL> --
SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
2 from dual
worked. but
SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
from dual
did not work?
IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
Thanks.did not work?Generally we'll need a bit more info than "it didn't work", was there an ora-X error message? What was the error?
Assuming you're on *nix a 'C:\<folder name>\...' directory spec just plain won't work, the directory has to point to a valid storage location on the database server host.
Try a host command (at the database server) and make sure the .xml file name and location is valid, in sqlplus a "bang" (exclamation) runs a host command, i.e.:
SQL> !ls -l /xdb/faq/testdata
... usr grp ... 2003.xml
...But if you are on windows, its the `host` command:
SQL> host dir c:\drag_list\modified
mm/dd/yyyy ... 2011.xml
... The create directory ... as ... must point to a valid storage location for it to work, at least that is step one. -
Hi all experts,
I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 22 11:40:23 2011
is there anyone know why
SQL> create or replace directory XMLDIR as '/xdb/faq/testdata'
2 /
SQL> set long 10000 pages 200 lines 150
SQL> --
SQL> select xmltype(bfilename('XMLDIR','2003.xml'),nls_charset_id('AL32UTF8'))
2 from dual
worked. but
SQL> create or replace directory XMLDIR as 'C:\Drag_list\Modified';
SQL> select xmltype(bfilename('XMLDIR','2011.xml'),nls_charset_id('AL32UTF8'))
from dual
did not work?
IS there any way I can load the .xml file list from 'C:\Drag_list\Modified' into xmltype table?
Thanks.
Edited by: Cow on Apr 13, 2011 12:58 AMThis is a question better suited for the sql and pl/sql support forum, since it is NOT an APEX based question..: PL/SQL
Thank you,
Tony Miller
Webster, TX
On the road of life...There are 'windshields', and there are 'bugs'
(splat!)
"Squeegees Wanted"
If this question is answered, please mark the thread as closed and assign points where earned.. -
Error loading xml file with sqlldr
Hi there,
I am having trouble loading an xml file via sqlldr into oracle.
The version i am running is Oracle Database 10g Release 10.2.0.1.0 - 64bit Production and the file size is 464 MB.
It ran for about 10 hours trying to load the file and then threw up the error:
ORA-22813: operand value exceeds system limits.
I have loaded a file of 170MB using the same process succesfully.
Any Ideas?
Cheers,
Dan.Looked a bit into the issue (ORA-22813) and although it can be caused by a lot of issues varrying database versions, you could have a go at sizing up your PGA database parameter. See Oracle support Doc ID 837220.1 for more info.
The following might help
CREATE OR REPLACE PROCEDURE show_pga_memory (context_in IN VARCHAR2 DEFAULT NULL)
SELECT privileges required on:
SYS.v_$session
SYS.v_$sesstat
SYS.v_$statname
Here are the statements you should run:
GRANT SELECT ON SYS.v_$session TO <schema>;
GRANT SELECT ON SYS.v_$sesstat TO <schema>;
GRANT SELECT ON SYS.v_$statname TO <schema>;
IS
l_memory NUMBER;
BEGIN
SELECT st.VALUE
INTO l_memory
FROM SYS.v_$session se, SYS.v_$sesstat st, SYS.v_$statname nm
WHERE se.audsid = USERENV ('SESSIONID')
AND st.statistic# = nm.statistic#
AND se.SID = st.SID
AND nm.NAME = 'session pga memory';
DBMS_OUTPUT.put_line (CASE WHEN context_in IS NULL
THEN NULL
ELSE context_in || ' - '
END
|| 'PGA memory used in session = ' || TO_CHAR (l_memory));
END show_pga_memory;
/ -
XML Parse error while loading an XML file
HI Folks,
I was trying to load and XML file into BODS.. The XML file is well-formed and the same when tested in other tools is getting loaded without any issues..
I have created a XML-File format with the corresponding XSD..
But here in BODS it is giving - Parse error
1) when i try to view the data of the source XML in my dataflow ..it is giving "XML Parser Failed".. and not able to show data..
2) When I run my job i get the same pares error - with details as under..
---> Error here is "Unable to recognize element 'TAB' " or some time is say " Element TAB should be qualified"
Please guide with this if you have any info..thanks
I'm pasting the XML source file format here for your reference:--
<?xml version="1.0" encoding="iso-8859-1" ?>
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
- <asx:values>
- <TAB>
- <items>
+ <CUSTOMER_RECORD>
<CUSTOMER_NUMBER>1111111111</CUSTOMER_NUMBER>
<NAME_1>ABC</NAME_1>
<NAME_2>OFM/COMMERCIAL ACCOUNTS</NAME_2>
<STREET_1>31 CENTER DRIVE MCS2045</STREET_1>
<STREET_2 />
<CITY>BETHESDA</CITY>
<STATE_CODE>MD</STATE_CODE>
<POSTAL_CODE>20892-2045</POSTAL_CODE>
<COUNTRY_CODE>US</COUNTRY_CODE>
<ORDER_BLOCK />
<ERP_CREATE_DATE>20040610</ERP_CREATE_DATE>
<ERP_CREATED_BY>DGUPTA</ERP_CREATED_BY>
<ERP_MODIFY_DATE>20120201</ERP_MODIFY_DATE>
<ERP_MODIFIED_BY>LWOHLFEI</ERP_MODIFIED_BY>
<INDUSTRY_CODE>0103</INDUSTRY_CODE>
<ACCOUNT_GROUP_ID>0001</ACCOUNT_GROUP_ID>
<SALES_NOTE />
<ADDRESS_NOTE />
<CUSTOMER_CLASSIFICATION_CODE>02</CUSTOMER_CLASSIFICATION_CODE>
<GLN_NUMBER />
<PREVIOUS_ACCT_NO />
<ACCOUNT_TYPE />
<GAG />
<SDI_ID />
<HOSP_ID />
<HIN />
<DUNS />
<PO_BOX />
<POB_CITY />
<POB_ZIP />
<PHONE_NUMBER>77777</PHONE_NUMBER>
<EMAIL_DOMAIN />
<REQUESTER />
<ERP_SOURCE_SYSTEM>ECC</ERP_SOURCE_SYSTEM>
</CUSTOMER_RECORD>
- <SALES_ORG_DATA>
+ <item>
<CUSTOMER_NUMBER>1111111111</CUSTOMER_NUMBER>
<SALES_ORG>0130</SALES_ORG>
<CUSTOMER_GROUP>03</CUSTOMER_GROUP>
<ORDER_BLOCK_CODE />
<ERP_SOURCE_SYSTEM>ECC</ERP_SOURCE_SYSTEM>
</item>
+ <item>
<CUSTOMER_NUMBER>1111111111</CUSTOMER_NUMBER>
<SALES_ORG>0120</SALES_ORG>
<CUSTOMER_GROUP>11</CUSTOMER_GROUP>
<ORDER_BLOCK_CODE />
<ERP_SOURCE_SYSTEM>ECC</ERP_SOURCE_SYSTEM>
</item>
</SALES_ORG_DATA>
</items>
</TAB>
</asx:values>
</asx:abap>Pierre,
Depending on the object "myLastFile", the method openDlg might not even exist (if the myLastFile object is not a File object, for instance). And I do not see any need for the myLastFile anyhow, as you are presenting a dialog to select a file to open. I recommend using the global ChooseFile( ) method instead. This will give you a filename as string in full path notation, or null when no file was selected in the dialog. I am not sure what your ExtendScript documentation states about the return value for ChooseFile, but if that differs from what I am telling you here, the documentation is wrong. So, if you replace the first lines of your code with the following it should work:
function openXMLFile ( ) {
var filename = ChooseFile ( "Choose XML file ...", "", "*.xml", Constants.FV_ChooseSelect );
While writing this, I see that Russ has already given you the same advice. Use the symbolic constant value I indicated to use the ChooseFile dialog to select a single file (it can also be used to select a directory or open a file - but you want to control the opening process yourself). Note that this method allows you to set a start directory for the dialog (second parameter). The ESTK autocompletion also gives you a fifth parameter "helplink" which is undocumented and can safely be ignored.
Good luck
Jang -
Loading an xml file from an xml file
I'm trying to load an xml file from an xml file, but I'm
having problems. My first xml file is really simple - it only
contains one attribute with the name of another xml file in it
(eventually I will have multiple xml files in here and run a loop
on them...this is why I want to load an xml file from an xml file).
Currently, with the code below, I can get the main xml file
to load ("main.xml"), but I cannot get the secondary xml files to
load FROM the main.xml.
I want to then take childNode values from the secondary xml
file and use them within my .swf in text boxes and whatnot.
Any guidance? I think I'm going wrong on the line where I'm
saying "i.newxml.load(i.attributes.location);"
- How can I get this to work?johnypeter:
I tried changing the code inside the loop to use just
"newxml" instead of "i.newxml", and I declared with "var newxml =
new XML();" - was this what you were thinking?
kglad:
The reason I tried to use the loadXML() function in the loop
was so that for each node in my "main.xml" it would load the new
xml file listed - this is a no-no? Do you have any ideas as to what
I could do?
For the for-loop, what should I change in it? I'm not great
with loops so I tried to modify some code from another loop I found
in another forum thread - not the right way to do it here?
Also, what should I trace? The value of the _root.address, or
i.attributes.location? I have created dynamic text boxes on my
stage to see if the correct value from the xml file loads (ie. the
name of the xml file within the xml file) and it does, but now I
don't know how to put that information into ANOTHER loadXML()
function and get the node information from it - does that make
sense???
Below are the examples of the xml files I am using. In the
first one, main.xml, I will have a list of multiple xml files, each
with the same nodes and elements as in the details.xml file
(different values, of course).
This is just to give you an example of what I'm trying to
accomplish - pulling ALL the addresses and phone numbers from
multiple xml files. I cannot manually collect this information, as
it is dynamic, and will be updated in each individual details.xml.
I was hoping to collect the information by simply adding to and
updating ONE xml file - main.xml.
Do you think this can be done? Am I going about it the wrong
way? I'm quite limited in AS knowledge, which is why I'm piecing
together code from other posts! -
Loading multiple XML files into one XMLList
I am working on an app where I will load a list of recipes. Each recipe is an XML file. I would have an XML file that lists the filenames that need to be loaded. I am assuming in can use one HTTPService and loop through this list, and set the url and do myService.send() until all the xml files have been loaded and concatenated into one xml list. True?
My main question here is how do I load each XML file and add it to the same XMLList?
Assume each XML file's root tag is <recipe>. I want to create an XMLList with the root <recipes> with each <recipe> as a first child.
Thanks.Why don't you use the Data centric workflows which will help you to deal with multiple XML files as AS objects? Something like this
1. Create a HTTPService using Data menu -> Connect to HTTPService
2. create a operation getRecipe and enter your URL example URL: http://myserver/recipe?name=recipename
3. Use Configure Return Type to tell that this method returns a Recipe class
4. Use DataBinding to bind the result of this to a DataGrid
Call the following in a loop and
recipeName = myRecipes+ // All of your recipe names, Recipe is a ArrayCollecition
Recipe.setAt(i) = Svc1.getRecipe(recipeName);
At the end you would have a Recipe[]
This is one of the ways you could work instead of having a XMLListCollection and use e4x etc. to go through your collection.
Let us know if this helps, or you are looking for something else.
Thanks
-Sunil -
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? -
An example about how to load a XML file
Hi,
I've been working on Oracle for many years but fot the first time I was asked to load a XML file into a table.
As an example, I've found this on the web, but it doesn't work.
Can someone tell me why? I hoped this example could help me.
the file acct.xml is this:
<?xml version="1.0"?>
<ACCOUNT_HEADER_ACK>
<HEADER>
<STATUS_CODE>100</STATUS_CODE>
<STATUS_REMARKS>check</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>2</SEGMENT_NUMBER>
<REMARKS>rp polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>3</SEGMENT_NUMBER>
<REMARKS>rp polytechnic administration</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>4</SEGMENT_NUMBER>
<REMARKS>rp polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>5</SEGMENT_NUMBER>
<REMARKS>rp polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
<HEADER>
<STATUS_CODE>500</STATUS_CODE>
<STATUS_REMARKS>process exception</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>20</SEGMENT_NUMBER>
<REMARKS> base polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>30</SEGMENT_NUMBER>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>40</SEGMENT_NUMBER>
<REMARKS> base polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>50</SEGMENT_NUMBER>
<REMARKS> base polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
</ACCOUNT_HEADER_ACK>
For the two tags HEADER and DETAILS I have the table:
create table xxrp_acct_details(
status_code number,
status_remarks varchar2(100),
segment_number number,
remarks varchar2(100)
before I've created a
create directory test_dir as 'c:\esterno'; -- where I have my acct.xml
and after, can you give me a script for loading data by using XMLTABLE?
I've tried this but it doesn't work:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
This should allow me to get something like this:
select * from xxrp_acct_details;
Statuscode status remarks segement remarks
100 check 2 rp polytechnic
100 check 3 rp polytechnic administration
100 check 4 rp polytechnic finance
100 check 5 rp polytechnic logistics
500 process exception 20 base polytechnic
500 process exception 30
500 process exception 40 base polytechnic finance
500 process exception 50 base polytechnic logistics
but I get:
Error report:
ORA-06550: line 19, column 11:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
and if I try to change the script without using the column HEADER_NO o keep track of the header rank inside the document:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
I get this message:
Error report:
ORA-19114: error during parsing the XQuery expression:
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.DBMS_XQUERYINT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at line 4
19114. 00000 - "error during parsing the XQuery expression: %s"
*Cause: An error occurred during the parsing of the XQuery expression.
*Action: Check the detailed error message for the possible causes.
My oracle version is 10gR2 Express Edition
I do need a script for loading xml files into a table as soon as possible
Thanks in advance!Hello,
Your code is not readable (no code tags).
Anyway, you can use SQL*Loader to load a XML document into a table.
Here is the link of the documentation with both description and an example at the end of the
article.
http://docs.oracle.com/cd/B19306_01/appdev.102/b14259/xdb25loa.htm
Regards,
Dariyoosh -
How to load a XML file into a table
Hi,
I've been working on Oracle for many years but for the first time I was asked to load a XML file into a table.
As an example, I've found this on the web, but it doesn't work
Can someone tell me why? I hoped this example could help me.
the file acct.xml is this:
<?xml version="1.0"?>
<ACCOUNT_HEADER_ACK>
<HEADER>
<STATUS_CODE>100</STATUS_CODE>
<STATUS_REMARKS>check</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>2</SEGMENT_NUMBER>
<REMARKS>rp polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>3</SEGMENT_NUMBER>
<REMARKS>rp polytechnic administration</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>4</SEGMENT_NUMBER>
<REMARKS>rp polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>5</SEGMENT_NUMBER>
<REMARKS>rp polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
<HEADER>
<STATUS_CODE>500</STATUS_CODE>
<STATUS_REMARKS>process exception</STATUS_REMARKS>
</HEADER>
<DETAILS>
<DETAIL>
<SEGMENT_NUMBER>20</SEGMENT_NUMBER>
<REMARKS> base polytechnic</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>30</SEGMENT_NUMBER>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>40</SEGMENT_NUMBER>
<REMARKS> base polytechnic finance</REMARKS>
</DETAIL>
<DETAIL>
<SEGMENT_NUMBER>50</SEGMENT_NUMBER>
<REMARKS> base polytechnic logistics</REMARKS>
</DETAIL>
</DETAILS>
</ACCOUNT_HEADER_ACK>
For the two tags HEADER and DETAILS I have the table:
create table xxrp_acct_details(
status_code number,
status_remarks varchar2(100),
segment_number number,
remarks varchar2(100)
before I've created a
create directory test_dir as 'c:\esterno'; -- where I have my acct.xml
and after, can you give me a script for loading data by using XMLTABLE?
I've tried this but it doesn't work:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
This should allow me to get something like this:
select * from xxrp_acct_details;
Statuscode status remarks segement remarks
100 check 2 rp polytechnic
100 check 3 rp polytechnic administration
100 check 4 rp polytechnic finance
100 check 5 rp polytechnic logistics
500 process exception 20 base polytechnic
500 process exception 30
500 process exception 40 base polytechnic finance
500 process exception 50 base polytechnic logistics
but I get:
Error report:
ORA-06550: line 19, column 11:
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
and if I try to change the script without using the column HEADER_NO to keep track of the header rank inside the document:
DECLARE
acct_doc xmltype := xmltype( bfilename('TEST_DIR','acct.xml'), nls_charset_id('AL32UTF8') );
BEGIN
insert into xxrp_acct_details (status_code, status_remarks, segment_number, remarks)
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
END;
I get this message:
Error report:
ORA-19114: error during parsing the XQuery expression:
ORA-06550: line 1, column 13:
PLS-00201: identifier 'SYS.DBMS_XQUERYINT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at line 4
19114. 00000 - "error during parsing the XQuery expression: %s"
*Cause: An error occurred during the parsing of the XQuery expression.
*Action: Check the detailed error message for the possible causes.
My oracle version is 10gR2 Express Edition
I do need a script for loading xml files into a table as soon as possible, Give me please a simple example for understanding and that works on 10gR2 Express Edition
Thanks in advance!The reason your first SQL statement
select x1.status_code,
x1.status_remarks,
x2.segment_number,
x2.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS[$hn]/DETAIL'
passing acct_doc as "d",
x1.header_no as "hn"
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS'
) x2
returns the error you noticed
PL/SQL: ORA-00932: inconsistent datatypes: expected - got NUMBER
is because Oracle is expecting XML to be passed in. At the moment I forget if it requires a certain format or not, but it is simply expecting the value to be wrapped in simple XML.
Your query actually runs as is on 11.1 as Oracle changed how that functionality worked when 11.1 was released. Your query runs slowly, but it does run.
As you are dealing with groups, is there any way the input XML can be modified to be like
<ACCOUNT_HEADER_ACK>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
<ACCOUNT_GROUP>
<HEADER>....</HEADER>
<DETAILS>....</DETAILS>
</ACCOUNT_GROUP>
</ACCOUNT_HEADER_ACK>
so that it is easier to associate a HEADER/DETAILS combination? If so, it would make parsing the XML much easier.
Assuming the answer is no, here is one hack to accomplish your goal
select x1.status_code,
x1.status_remarks,
x3.segment_number,
x3.remarks
from xmltable(
'/ACCOUNT_HEADER_ACK/HEADER'
passing acct_doc
columns header_no for ordinality,
status_code number path 'STATUS_CODE',
status_remarks varchar2(100) path 'STATUS_REMARKS'
) x1,
xmltable(
'$d/ACCOUNT_HEADER_ACK/DETAILS'
passing acct_doc as "d",
columns detail_no for ordinality,
detail_xml xmltype path 'DETAIL'
) x2,
xmltable(
'DETAIL'
passing x2.detail_xml
columns segment_number number path 'SEGMENT_NUMBER',
remarks varchar2(100) path 'REMARKS') x3
WHERE x1.header_no = x2.detail_no;
This follows the approach you started with. Table x1 creates a row for each HEADER node and table x2 creates a row for each DETAILS node. It assumes there is always a one and only one association between the two. I use table x3, which is joined to x2, to parse the many DETAIL nodes. The WHERE clause then joins each header row to the corresponding details row and produces the eight rows you are seeking.
There is another approach that I know of, and that would be using XQuery within the XMLTable. It should require using only one XMLTable but I would have to spend some time coming up with that solution and I can't recall whether restrictions exist in 10gR2 Express Edition compared to what can run in 10.2 Enterprise Edition for XQuery. -
Loading an xml file from jws : a nightmare !
Hi all:
I'm trying to load a xml file packed inside a jar file, and when i call getresource it keeps always returning null !!!
When i run the application (not in JWS) the file is loaded, but when i run it from a jnlp file with jws no !!
I tried all possible solutions wihout success :(
the last portion of code i used is :
ClassLoader cl = this.getClass().getClassLoader();
URL xmlFile=cl.getResource("configure.xml"); why is it working when run from Eclipse but fails when using jws ?
I packed all my .class files together with xml file in one jar.
please help me ! this stuff is driving me crazy :(
thanks.Hi phasse !
Yes I've fortenatly managed to solve my problem .here is the desription:
Actually my problem was not with loading the xml file but in reading it .
my problem was in the statement builder.parse(xmlFile.getPath()); this will not work with jws .I replaced this with : Document document = null;
try {
ClassLoader cl = this.getClass().getClassLoader();
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
document=builder.parse(cl.getResourceAsStream("resources/configure.xml"));I would suggest to use ClassLoader and getResourceAsStream("xmlfile") method .
I hope this would be helpfull for you .Good luck !
Maybe you are looking for
-
Error in running the Program SDRQCR21
Hi, For a material,the sales order which are rejected are showning in MD04.When i try to run this program SDRQCR21,it gives me timed out error. Since there are lot of sales order for that material. Please can any one help me in this issue... Thanks S
-
Broadcast Bex queries in CSV format
Hi, Is there a way to broadcast Bex queries in "CSV" format? Please do not confuse this with the "Export to CSV" option. I need to be able to set up the job periodically to send the reports in CSV format. Any ideas... Thanks
-
Custom field mappings in query
Hello In our classes we use GregorianCalendar for date representation. Therefore I wrote a ColumnFieldMapping class for mapping of GregorianCalendar to SQL_DATE. (I used the SQLDateMapping class as example). The storing and retrieving works without p
-
How to avert that iMessage is sent as SMS?
I found that there was some international SMS charge last month. I remembered that I sent several iMessages to my friends, but it seemed that some of them failed. So they were sent as SMS. How to avoid such issue?
-
Adobe reader X doesn´t work on my netbook
I have a Netbook Toshiba with Intel atom CPU N570, 1,66 GHz, ram 1GB , os windows 7 32 bits. When i actualice versión of reader by the XI doesn´t work an I need help, i need my pdf reader works well