Displaying photos from an XML file

Here's my next little challenge: have to build an app that
shows a bunch of photos (listed in an XML file) based upon certain
criteria in the XML data. First view will show ALL the photos, and
then the user will whittle down the choices/photos based upon
criteria they select via check boxes.
I'm sure I can now figure out how to pull the XML data into
the application. I'll have to build a listener for the check box
component(s), which shouldn't be difficult. The onClick event would
then have to search through the XML/array and show only the
user-selected data. It would be good also if the pictures were
actually pulled from the server's hard drive rather than having
them stored in the Flash file. That would allow the site's owner to
easily add images by simply copying them to the server and adding
data to the XML. Is that do-able, and if so, can anyone put me on
the right path (theorhetically) to developing it?
The other question I have at this pre-planning stage is this:
ALL the pix are certainly not going to fit on the stage at one
time. I am going to have to have a finite number of pix, say six,
visible on the stage, and then allow the user to filter through the
as-yet-unseen images by clicking on a number (Page 2 of 7), or
something along those lines.
Before I get too deep into the project, can anyone give me
some theory on how something like that might be accomplished? I'm
trying to kinda map this one out in my head prior to getting knee
deep in code.
Thanks!

Hey Nick,
For the pulling the pics from the server part, just have the
XML reside on the server along with the images and point your flash
app to
http://servername/mypics.xml
The XML can contain relative links to the pictures
<myxml>
<pic>
<location>/images/mypic.jpg</location>
<description>fancy house</description>
<etc...></...etc>
</pic>
</myxml>
As for the determining how many pages of pics you have,
once you load the XML into and XMLList object (you've done
this before), you can search through, get the number of pics, etc.
So you'll have to build your app like:
var pageCount = 1;
for(var i=0;i<myXML.pic.length;i++){
if(i%6==0){
pageCount++;
Hope that helps!
Cheers,
FlashTastic

Similar Messages

  • Create a list from an XML file    no display

    I have a multiline Dynamic text box called projList.
    I am trying to populate it from an xml file and create a
    clickable list.
    The trace works but cannot get to display the list in the
    text box.
    As far as the clickable goes, haven't gotten that far yet.
    Help very much appreciated.
    The xml is structured like this:
    <?xml version="1.0" ?>
    - <images>
    - <pic>
    <Image>/Butler/Images/sfah2_small.jpg</Image>
    <Category>Institutional</Category>
    <Proj_title>FRESH AIR HOME</Proj_title>
    Please see code below:
    import mx.xpath.XPathAPI;
    var allproj_xml:XML = new XML();
    allproj_xml.ignoreWhite = true;
    allproj_xml.onLoad = function(success:Boolean) {
    trace("onload...");
    if (success) {
    trace("success...");
    var thePath_str:String = "/images/pic/Proj_title";
    var title_array:Array =
    XPathAPI.selectNodeList(this.firstChild,
    thePath_str);
    for (var i:Number = 0; i < title_array.length; i++) {
    trace(title_array
    .firstChild.nodeValue);
    projList.addItem(title_array.attributes.Proj_title);
    } else {
    trace("error loading XML");
    allproj_xml.load("allimages.xml");
    stop();

    This did it:
    projList.addItem(title_array
    .firstChild.nodeValue);
    > Thanks for your response.
    > How can I add what I am tracing, to the component
    properly?
    >
    > "DMennenoh **AdobeCommunityExpert**"
    <[email protected]> wrote in
    > message news:eqaejh$bi8$[email protected]..
    >>>>trace(title_array.firstChild.nodeValue);
    >> projList.addItem(title_array
    .attributes.Proj_title);
    >>
    >>
    >> Your code seems OK. What you are tracing here
    however isn't what you're
    >> adding to the component. Are you sure what you're
    adding traces?
    >>
    >> --
    >> Dave -
    >> Head Developer
    >> www.blurredistinction.com
    >> Adobe Community Expert
    >>
    http://www.adobe.com/communities/experts/
    >>
    >

  • How to display Japanese text from an XML file

    Hiya,
    I have various adapted mp3 players [called playlists on my site] which retrieve the songs and song titles/artists from an XML file. One of them plays Japanese music.
    Most of the tracks are in English but I now have a couple of songs with Japanese titles and file names which I can't get to preview/display in Flash Pro CS5 [Mac]. I can type static Japanese text and it displays fine but Flash seems to be having a problem with the Japanese from the XML file.
    Though I can find the English titles, etc, it would be nice if there were a way to display Japanese text from a 'multi-lingual' [English and Japanese] XML file [probably something really easy].
    Thanks a bunch.
    steve

    This should help you:
    http://http://www.packtpub.com/article/working-with-xml-in-flex3-and-java-1http://www.packtpub.com/article/working-with-xml-in-flex3-and-java-1

  • Crystal Report that reads from an XML file Datetime or Date

    I have a Crystal Report 2008 that reads from an XML file, the source File XML Date data looks like this: 2008-03-10
    But the Crystal Report interpreted by datatime, I need the Crystal Report to look like this: 2008/03/10 (date) not 2008-03-10T00:00:00-05:00 (datatime)
    Look at an example (source file xml, report, and parameter file to execute report) at url: http://www.5websoft.com/sample.zip
    Import the file in the design and will to verify that interpret incorrectly the fields of type date as datetime
    not mapped currently for fields..
    Help.....
    Thanks!

    You could always reformat the field to only display the date portion:
    Format Field > Date and Time tab; choose the date style you need here.
    Or create a formula to extract just the date and use this field in your report:
    date({table.field})

  • Error loading data from an XML file using HTTPService

    Hello All,
    I have a runtime error that has got me beat at the moment   I am building an App in Flash Builder 4 to run on AIR.
    The error is as follows: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    What i'm Trying to Do:
    I have 2 DropDownList controls, the first is populated with country names and the other with language options.  All the 1st DropDownList control does
    is set an image control to display the country flag and enable the 2nd DropDownList.
    The 2nd DropDownList sets the langCode variable equal to the chosen language code.  I then call the language function and pass it langCode.  Using this variable, I build up the string
    so that langFilePath will be equal to the XML file (which is "Lang_GBR.xml") location on my desktop and then call the HTTPService.
    As soon as the language function is called, the runtime error occurs and highlights the line with btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
    where I try to assign the button label with a new value from the XML file.
    I suspect this may be a trivial error but I just can't see it at the moment. 
    Any help or guidance would be appreciated.  Thanks
    Code:
    <fx:Script>
            <![CDATA[
                   [Bindable]
                   public var langFilePath:String;
                   public var langDir:File = File.desktopDirectory;
                   public var langCode:String;
                   public function countrySelect_changeHandler(event:IndexChangeEvent):void
                        switch (countrySelect.selectedItem)
                             case ('United Kingdom'): 
                                  trace("Item Selected was: "+ countrySelect.selectedItem);
                                  img_countryFlag.source = AngolaFlag;
                             break;
                             case ('France'): 
                                   trace("Item Selected was: "+ countrySelect.selectedItem);
                                   img_countryFlag.source = AustraliaFlag;
                             break;
                             default: 
                             break;
                        langSelect.enabled = true;
                        trace("1st dropdownbox");
                   public function langSelect_changeHandler(event:IndexChangeEvent):void
                        switch (langSelect.selectedItem)
                             case ('English'): 
                                 trace("Language Selected was: "+ langSelect.selectedItem);
                                 langCode = "Lang_GBR"; 
                             break;
                             case ('French'): 
                                 trace("Language Selected was: "+ langSelect.selectedItem);
                                 langCode = "Lang_FRA"; 
                             break;
                        language(langCode);
                   public function language(aParam:String):void
                        trace("Code Was: " + aParam);
                        trace("Lang dir: " + langDir.nativePath);
                        langFilePath = langDir.nativePath + "/" + aParam + ".xml";
                        trace("File to load: " + langFilePath);
                        trace("loadLangFile.url: " + loadLangService.url);
                        loadLangService.send();
                        btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
              ]]>
    </fx:Script>
    <fx:Declarations>
         <s:HTTPService id="loadLangService" url="{langFilePath}"/>
    </fx:Declarations>
    <s:DropDownList x="10" y="201" id="countrySelect" prompt="Please Select Your Country" width="274" enabled="true" change="countrySelect_changeHandler(event)">
    <s:DropDownList x="10" y="348" id="langSelect" prompt="Please Select Your Language" width="274" enabled="false" change="langSelect_changeHandler(event)">

    Don't sure about your XML structure, but for now i see the problem here between this 2 lines of code:
    loadLangService.send();
    btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;
    Think data that your httpService should receive just can't go so fast to populate the lastResult before you call it in the next line
    Try adding a result listener to your service before you send it:
    loadLangService.addEventListener(ResultEvent.RESULT, handler);
    loadLangService.send();
    function handler(event:ResultEvent):void {
         btn_LS_mainMenu.label = loadLangService.lastResult.Lang.GlobalTags.btnMenu;

  • Draw a picture from a XML file

    Hi,
    the problem I have is the following.
    We have a UI (JNET) where you can create a data model which later on will be analyzied for data conistency. All details of the data model are stored in an XML file. To document what we did we need to create a word report. This word report should also contain a pricure of the data model which should be included automatically. The creation of the report itself is not a problem but I have no idea how I can include the picture of the data model.
    Is there a way of drawing/ a picture (jpg, gif, png, etc.) from a XML file using ABAP?? 
    I attached an example of the data model. It is also the target which should be displayed from the XML file.
    Thanks for your support.
    Best regards,
    Niklas

    Hi,
    Thanks for the reply.I got the solution for my problem.Actually i wanted to delete only a particular element.
    The solution to this is after using
    Element element = (Element)document.getElementsByTagName("job").item(r-2);
    element.getParentNode().removeChild(element);
    writeXmlFile(document,"xmlfilename");.

  • Importing Arabic text from an XML file

    Importing text from an XML file to appear as text in Flash
    works in English, however if the text I want to import is in
    Arabic, when I test the movie there is no text at all.
    Is there some particular syntax to preface the Arabic text?
    I'll want to import text from XML in other languages too.
    (French)
    I'd cut and pasted some Arabic text into the XML file that
    displays pictures and text in the "slideshow.fla" (
    http://www.adobe.com/support/flash/applications/jpeg_slideshow_xml/jpeg_slideshow_xml03.ht ml)
    Substituting Arabic text for English text, editing the XML
    file with Dreamweaver.
    Any ideas as to how I might achieve my objective of importing
    Arabic text into Fash?
    I'd started developing my prototpe in Macromedia Director 7,
    and then Director MX, but I have not found a suitable Arabic font
    that I can embed that will allow me to display Arabic fonts in
    Adobe Director. I have the Arabic text in a Word document.
    I've dicovered that my Flash MX Pro and Dreamweaver both
    support Arabic fonts, but I want to import text from an XML file.
    I'd prefer using cast libraries and cast members, but I don't
    know of an equivalent in Flash to what I'm comfortable with in
    Director.

    Oh so many questions. You probably aren't going to like the
    answers. I have Flash MX04 pro (aka Flash 7) and things made a big
    jump between MX (aka 6) and MX04. If you only have MX, there might
    not be a way to do this. All my advice is based upon MX04 or
    higher.
    It is possible to do complex languages in Flash. My
    experience is with Hindi and I've helped a few folks here with
    Arabic.
    You won't be able to use text from Microsoft Word – at
    least I don't think so. The XML file will need to be saved in the
    UTF-8 format. I think Word uses its own scheme and won't work. But
    I'm not a Word expert. Something like Text Edit (Mac) or WordPad
    (PC) should be able to save a UTF-8 file.
    The next problem is you mention "suitable Arabic font that I
    can embed." AFAIK, you can't embed any of the complex scripts in
    Flash. You just have to rely on the end user having appropriate
    fonts installed and enabled. Most operating systems from 2000 on do
    have this – although some folks like to remove them to save
    space.
    Next issue will be line composing. I've found that when using
    anything above the normal Latin range that Flash suddenly forgets
    how to make a line fit into a text area. It will just break things
    in the middle of words and not even notice the spaces between
    words. I've written a little snippet of code that "composes" the
    lines. It works well with Hindi and folks here have used it with
    Arabic and not come back saying that it doesn't work. Search the
    forums (both the Flash and Actionscript) if you can't find it I'll
    dig it out when I get home.
    So here is the checklist:
    Make sure the XML is saved in UTF-8
    Import the XML file
    In Testing environment go Debug–>List variables.
    Does it show up correctly there?
    Does it show at all in a text field?
    Use the "composer" to make the lines break.

  • Extracting from an xml file..

    hi.. i am required to write a program that extracts and perform certain calulations with stock numbers. I have been able to complete the calcuations part but need a little help(ideas, guildines) when xtracting stuff from a xml file that has six lines..
    <?xml version="1.0"?>
    <Portfolio>
    <Investment><Stock symbol="RY"></Stock><Qty>15</Qty><Comment>this is a good one; esp. the BookValue</Comment><BookValue>58.5</BookValue></Investment>
    <Investment><Comment>this is not "bad"</Comment><Stock symbol = "NT"></Stock><Qty>10</Qty> <BookValue>108</BookValue></Investment>
    <Investment><Qty>2</Qty><BookValue>45.75</BookValue><Comment>not sure about this; >= last time</Comment><Stock symbol= "BMO" > </Stock></Investment>
    </Portfolio>
    I'm not sure if this post will display properly but the correct format is this..
    Line 1: <?xml version=...
    Line 2: <Portfolio...
    Line 3: <Investment...
    Line 4: <investment...
    Line 5: <investment...
    Line 6: </Portfolio.....
    The stuff i'm supposed to extract are..
    RY 15 58.50
    NT 10 108.00
    BMO 2 45.75
    I am new to java and i am still beginning to realize the many methods that enable me to do this.. if anyone has any ideas please let me know.. thank you for ur time.
    (I'm not requesting actual coding..) Thanks again.

    Hey kk.. thanks for helping out but unfortunatly.. i can't use a parser like u.. since i'm taking an introductory course we're only limited to a number of classes to use(we're not suppoesd to know much we have to work with what we have). This is the coding i have so far..
    public class Test
    {     public static void main(String[] args)
         {     YorkReader reader = new YorkReader("pfxml.a1.xml");
              String line = reader.readLine();
              String tag = line.substring(0,7);
              String investTag = "<Invest";
              while (!tag.equalsIgnoreCase(investTag))
                   York.println(line);
                   line = reader.readLine();
                   tag = line.substring(0,7);
              while(tag.equalsIgnoreCase(investTag))
                   York.println(line);
                   line = reader.readLine();
                   StringTokenizer st = new StringTokenizer(line, "Stock");
                   String line1 = st.nextToken();
                   StringTokenizer stSymbol = new StringTokenizer(st.nextToken(), "\"");
                   String symbolS = stSymbol.nextToken();
                   York.println();
                   York.println(line1);
                   York.println();
                   tag = line.substring(0,7);
              reader.close();
    I've managed to get the program to skip lines that don't match the string "Invest" and once i get to invest i'm planning to use loop and extract the stuff i need out of the line.. but for some reason(IT'S DRIVING ME CRAZY).. is that when i try to use the Tokenizer class to parse out what i need.. it doesn't work. U see.. in the code i used the string "Stock" as the delimiter.. but when i check to see if the code is working it's not returning what i'm asking for.
    When i ask it to print out the first token it returns this..
    <Inves
    and when i ask for the second it gives me..
    men
    what is going on... argh.. i thought i had a great idea to do this too.. like wat i was planning was.. use "Stock" as the delimiter and get the string
    symbol="RY"></
    then use tokenizer again and use " as the delimiter to get the RY string which is what i want.. but for some reason it's not doing that.. if u have time could u take a look at my coding and let me know what's wrong?.. thanks a lot for ur help.. i really appreciate it.

  • Passing info from a XML file to URLloader

    I am new to Flex (And programming alltogether), so please
    excuse my ignorance when asking this question; but I have to start
    somewhere. :-)
    I have an application using HTTPService that pulls
    information from a XML file and displays an image and text within
    the window depending on the selected item. The image and text
    appears as needed from {data.image} or {data.text} calls to their
    appropriate field. On that same window, I want to add a link button
    that will direct the browser to a new page depending on the
    selected item. I have the link for each item embedded in the XML
    file, but I cannot figure out how to pass the link to the button.
    I have tried to create a function, but the URL isnot passed
    to the broswer. The application tells the browser to go to
    "{data.link}" at the local server, not the actual URL.
    my function looks like this:
    public function newPage():void
    var getLink = '{data.link}';
    var request:URLRequest = new URLRequest(getLink);
    var loader:URLLoader = new URLLoader();
    loader.load(request);
    }

    hi,
    can you share php code for grabbing data. i make php code using "simplexml_load_file" but the problem is it takes 2-3 minutes before it show the result. i want to monitor the current video if stop feeding.
    http://server1:1111/admin/getLiveStreams?auser=admin&apswd=admin&appInst=appname
    xml
    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <result> 
    <level>status</level> 
    <code>NetConnection.Call.Success</code>
    <timestamp>3/21/2015 7:47:17 AM</timestamp>
    <name>_defaultRoot_:_defaultVHost_:::_0</name>
    <data> 
    <_0>appname</_0> 
    </data>
    </result>
    here;s my php code:amsstats.php
    <?php
        $result = simplexml_load_file("http://server1:1111/admin/getLiveStreams?auser=admin&apswd=admin&appInst=appname");
        echo $result->data[0]->_0;
    ?>
    result:
    http://server2/stats/amsstats.php

  • How to read configuration data from an xml file (not web.xml)?

    Hi,
    I want to separate the application specific configuration parameters in a separate xml file and read them as and when they are needed? I know that I can use the wb.xml but I want to separate them in a different xml file because I don't want the web.xml file to be played around later after deployment. If any change is needed then it should be done in the application-config.xml.
    How can I read the parameters from this xml file in my jsp code and also what should be the location of this file if I have
    ../webapps/Root/application
    directoty structure ?
    Any help is greatly appreciated.

    can you give an example of a property file and also
    it is loaded in the jsp ?Hmm... loading properties in a JSP is not a very good idea. You should do it in a separate class, rather than mixing the logic with the display logic.
    Properties properties = new Properties();
    properties.load(UtilClass.class.getResourceAsStream("config.properties"));
    // Add a try - catch block around the load
    // for IOException...

  • How to save an n-ary tree of nodes to and from an xml file

    Hello,
    I am trying to represent a n-ary tree of nodes in xml.
    More accurately, I am trying to save/instantiate a
    tree of nodes to-from an xml file.
    How do I represent the parent-child relationships?
    Java: (simplified)
    class Node {
    Arraylist childNodes;
    Node parent;
    XML:
    From what I have been learning about XML,
    DTD:
    <?xml version="1.0" ?>
    <!DOCTYPE acd
         <!ELEMENT Node (childNodes, parent)>
         <!ATTLIST Node id ID #REQUIRED>
         <!ELEMENT childNodes (Node*)>
         <!ELEMENT parent (Node?)>
    ]>
    Qs:
    1) How do I represent the relationships? What would
    normally be a reference in Java, how do I represent in
    XML?
    2) Do I use ID, IDREF? I have been trying to find some
    examples to learn how. i.e. Does the IDREF, ID
    automatically become an in-memory reference (or pointer)?
    3) Is it preferable to use XML schema?
    thanks,
    Anil Philip
    Olathe, KS
    for good news go to
    http://members.tripod.com/goodnewsforyou/goodnews.html

    I downloaded XML Spy and used it to correct my earlier schema.
    Qs:
    In the instance document xml file;
    1) How would one display the parent node?
    2) If a child has a reference to a parent node as in the schema below, how can one know that the references are the same?
    i.e. when the parent node is first declared and when it is referred to by the child.
    Perhaps this raises a larger question - how does XML handle recursive references?
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://juwo.com/acd" xmlns="http://juwo.com/acd" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:annotation>
              <xs:documentation>ACD nodes. juwo LLC 2005</xs:documentation>
         </xs:annotation>
         <xs:complexType name="Node">
              <xs:sequence>
                   <xs:element name="parent" type="Node" minOccurs="0"/>
                   <!-- Node[] childNodes -->
                   <xs:element name="childNodes" type="ListOfNodes"/>
                   <!-- String data -->
                   <xs:element name="data" type="xs:string"/>
              </xs:sequence>
              <!-- Node parent -->
         </xs:complexType>
         <xs:complexType name="ListOfNodes">
              <xs:sequence>
                   <xs:element name="i" type="Node" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>

  • Creation of a shipping notification for a PO in EBP from a XML file via XI.

    Hi everybody.
    We are trying to create a shipping notification for a Purchase Order in Enterprise Buyer from a XML file via XI.
    For to do it, we are using ‘DespatchedDeliveryNotification_In’ message interface (transaction SPROXY).
    But when we execute it, the system show us next message:
    "An error occured within an XI interface: An exception with the type CX_GDT_CONVERSION occurred, but was neither handled locally, nor declared in a RAISING clause Programm: SAPLBBP_BD_MAPPING_SAPXML1; Include: LBBP_BD_MAPPING_SAPXML1F5B; Line: 4"
    No more information is available.
    Is there any additional transaction to see more information about the error message?
    Is there any documentation about this XML file, mandatory fields, examples…?
    We populated some fields in our XML file, but we do not know if the problem is with mandatory fields, data, program error…
    I will thank for any information
    Thanks in advance.
    Raúl Moncada.

    Raúl,
    This is because of the inbound UOM.
    The include LBBP_BD_MAPPING_SAPXML1F5B is in charge of mapping the item Unit Of Mesure (UOM) sent in the ASN XML file (it should be an ISO code).
    You can test FM UNIT_OF_MEASURE_ISO_TO_SAP with this inbound ISO code.
    PS: you should create an OSS message so the mapping sends back an error message instead of generating an uncatched exception (that generates a dump).
    Rgds
    Christophe
    PS: please reward points for helpfull answers

  • Need to insert values into a table from a XML file

    Hi,
    I'm an Oracle 9i/10g DBA with quite a few years experience, but I'm new to XML and dealing with it in database terms. I've been given a project that entails pulling XML values out of a file (or 100's of them) and storing them in the database so that they are searchable by end-users. The project is classified as secret so I'm unable to upload the specific XML or any info relating to the structire of the XML or the table I will use to insert the values into - sorry!! So, I've created an XML file with a similar structure to help people understand my predicament.
    The end-users only need to search on a subset of the total amount of columns from the table I'll insert data into, although the XML file has a lot more, so I dont need to store the other values - but I will need to store the name of the XML file (or a pointer to it so I know what XML file a particular set of values belong to) in another column of the table along with its associated values.
    I've been using the XMLTABLE function with some degree of success, although I had better succes using the XMLSEQUENCE function. However, I found out this is deprecated in 10g and replaced with XMLTABLE, so I guess it's better if I use this in case we ever need to upgrade to 11g.
    The main problem I've been having is that some elements in the XML files have multiple values for the one record when all the other records are the same. In terms of storing this in the database, I guess it would mean inserting multiple rows in the table for each element where the value differs. Here is a dumbed down XML file similar to what I've got along with the other SQL I've used:
    +<?xml version="1.0" encoding="UTF-8"?>+
    +<House>+
    +<Warehouse>+
    +<WarehouseId>1</WarehouseId>+
    +<WarehouseName>+
    +<Town>Southlake</Town>+
    +<State>Texas</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>25000</Area>+
    +<Docks>2</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Street</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>2</WarehouseId>+
    +<WarehouseName>+
    +<Town>Poole</Town>+
    +<State>Dorset</State>+
    +</WarehouseName>+
    +<WarehouseName>+
    +<Town>Solihull</Town>+
    +<County>West Midlands</State>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>40000</Area>+
    +<Docks>5</Docks>+
    +<DockType>Rear load</DockType>+
    +<WaterAccess>true</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>10</VClearance>+
    +</Warehouse>+
    +<Warehouse>+
    +<WarehouseId>3</WarehouseId>+
    +<WarehouseName>+
    +<Town>Fleet</Town>+
    +<County>Hampshire</County>+
    +</WarehouseName>+
    +<Building>Owned</Building>+
    +<Area>10000</Area>+
    +<Docks>1</Docks>+
    +<DockType>Side load</DockType>+
    +<WaterAccess>false</WaterAccess>+
    +<RailAccess>N</RailAccess>+
    +<Parking>Bay</Parking>+
    +<VClearance>20</VClearance>+
    +</Warehouse>+
    +</House>+
    CREATE TABLE xmltest OF XMLTYPE;
    INSERT INTO xmltest
    VALUES(xmltype(bfilename('XML_DIR', 'test.xml'), nls_charset_id('AL32UTF8')));
    Consequently, I need to...
    1) Retrieve the results from the XML file for all 3 warehouses where multiple values for the same sub-element are shown as 2 rowsthe result set. (I am guessing there will be 4 rows returned as warehouse sub-2 has 2 different elements for <WarehouseName>.
    2) Build a case statement into the query so that regardless of the sub-element name (i.e State or County), it is returned into the 1 column, for instance County.
    So, if I run a query similar to the following...
    select y.WarehouseId, y.Town, y.County, y.Area
    from xmltest x, xmltable('/House/Warehouse' .......
    I would like to get results back like this...
    ID Town County Area
    1 Southlake Texas 25000
    2 Poole Dorset 40000
    2 Solihull West Midlands 40000
    3 Fleet hampshire 10000
    Sorry for the non-formatting but I hope this all makessense to someone out there with what I'm trying to do.
    I appreciate any help whatsoever because, as i said before, I'm totally new to XML and trying to read the vast amount of information there is out there on XML is all a bit daunting.
    Many thanks in advance,
    Shaun.

    Hi again,
    Thanks for keeping the post open for me. I've had a look at the post illustrating the XFileHandler package, and tried to alter it to make it fit with my XML files. To help explain things, my XML file looks like this:
    <?xml version="1.0"?>
    <!DOCTYPE  CMF_Doc SYSTEM "CMF_Doc.dtd">
    <House>
        <Warehouse>
        <WarehouseId>1</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>House
        <WarehouseId>2</WarehouseId>
        <WarehouseName>
           <Town>Poole</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>3</WarehouseId>
        <WarehouseName>
           <Town>Fleet</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>4</WarehouseId>
        <WarehouseName>
           <Town>Dallas</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>5</WarehouseId>
        <WarehouseName>
           <Town>Dorchester</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Solihull</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>40000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>6</WarehouseId>
        <WarehouseName>
           <Town>Farnborough</Town>
           <County>Hampshire</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>
    <?xml version="1.0" encoding="UTF-8"?>
    <House>
        <Warehouse>
        <WarehouseId>7</WarehouseId>
        <WarehouseName>
           <Town>Southlake</Town>
           <State>Texas</State>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>25000</Area>
        <Docks>2</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Street</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>8</WarehouseId>
        <WarehouseName>
           <Town>Bournemouth</Town>
           <State>Dorset</State>
        </WarehouseName>
        <WarehouseName>
           <Town>Shirley</Town>
           <County>West Midlands</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>30000</Area>
        <Docks>5</Docks>
        <DockType>Rear load</DockType>
        <WaterAccess>true</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>10</VClearance>
      </Warehouse>
      <Warehouse>
        <WarehouseId>9</WarehouseId>
        <WarehouseName>
           <Town>Clapham</Town>
           <County>London</County>
        </WarehouseName>
        <Building>Owned</Building>
        <Area>10000</Area>
        <Docks>1</Docks>
        <DockType>Side load</DockType>
        <WaterAccess>false</WaterAccess>
        <RailAccess>N</RailAccess>
        <Parking>Bay</Parking>
        <VClearance>20</VClearance>
      </Warehouse>
    </House>And the XFilehandler package looks like this (I'm just trying to do a simple select only on WarehouseId & WaterAccess for the time being to keep things simple):
    create or replace package XFileHandler as
      TYPE TRECORD IS RECORD (
        WID     NUMBER(2)
      , WACCESS VARCHAR2(5)
      type TRecordTable is table of TRecord;
      function getRows (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipelined;
    end;
    create or replace package body XFileHandler is
      function getRows (p_directory in varchar2, p_filename in varchar2)
       return TRecordTable pipelined
      is
        nb_rec          number := 1;
        tmp_xml        clob;
        tmp_file         clob;
        rec               TRecord;
      begin
        DBMS_LOB.CREATETEMPORARY(TMP_FILE, TRUE);
        tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
        LOOP
          tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
          exit when length(tmp_xml) = 0;
          --dbms_output.put_line(tmp_rec);
          nb_rec := nb_rec + 1;
        select y.WID, y.WACCESS
        into rec.WID, rec.WACCESS
        from xmltable('/House' passing xmltype(tmp_xml)
                      columns WID NUMBER(2) PATH 'Warehouse/WarehouseId',
                                  WACCESS VARCHAR2(5) PATH 'WaterAccess') y;
          pipe row ( rec );
        end loop;
        dbms_lob.freetemporary(tmp_file);
        return;
      end;
    end;Now, when I run the query:
    select * from table(XFileHandler.getRows('XML_DIR', 'XFileHandler_test.xml'));I get the error: ORA-00600: internal error code, arguments: [17285], [0x5CFE8DC8], [4], [0x45ABE1C8], [], [], [], []
    I had a look in the dump file for anything obvious, but nothing really stands out. Is there anything obvious in my code that I'm missing or something else which you may think could be causing this error, e.g in the regular expression regexp_substr?
    Many thanks,
    Shaun.

  • How can I read an XML string that's not from an XML file?

    I've got a script I'm trying to setup that communicates over a socket to retrieve different directions from a custom built Java program.  The Java program listens to requests from the Adobe scripting engine (in my case it's a Photoshop script) on a socket and immediately responds with the next set of directions.  These directions are currently in XML format.  The issue I'm having is that I can't parse the XML data since it's entered into a new XML object from a string rather than being read from a file.  Even without the socket code, you can see the issue by doing the following:
    var xml = new XML("<test><data>hey!</data></test>");
    alert(xml.test.data);
    alert(xml);
    The first alert "should" return "hey!" (without quotes, of course), but it doesn't, while the second alert returns what you would expect it to:
    <test>
        <data>hey!</data>
    </test>
    It works fine if read from an XML file, but from a string, like shown above, it just presents an empty alert box when attempting to access "xml.test.data".  Any ideas on how to fix this issue?  Can it be fixed?  Has it been fixed in newer versions (I'm currently using CS4)?
    Thanks in advance for any help!

    Duh... found my error... I was attempting to access the data by referencing the created "root" element.  Since <test> is the very first element tag, it's setup as the root element, which you don't need to reference.  Changing the alert to alert(xml.data); fixed it.
    Now I just feel dumb, lol...

  • How can I find a photo from the backup file in my pc?

    How can I find a photo from the backup file in my pc?
    I have accidentally erased a photo. It happened after the backup.

    I am not aware you can extract a single photo or a single app's content from the backup, you can either restore the whole backup to your phone or not restore. If you restore your last backup to your phone then any content that is currently on your phone will be replaced with what was on it at the time that the backup was made - so if you do decide to restore, first copy off any purchases to your computer's iTunes via File > Transfer Purchases, and copy any documents/files that you've udpated on the phone since the backup.

Maybe you are looking for

  • How to connect two thunderbolt devices to Macbook Air?

    I have been using an Apple thunderbolt to VGA adapter to connect my digital projector to a Macbook Air.  Now I need to also connect a pro audio firewire mixer, which has a firewire 400 cable.  If I didn't have to connect the projector as well, I pres

  • Purchasing document security problem

    we are on 12.0.6 There are four document security options [Purchasing, hierarchy, Private and Public] We had hierarchy set for Standard Purchase orders which means only the doc owner, subsequent approvers, and individuals above the document owner in

  • Customer button in IS-U/CSS CIC

    Hi gurus, I'm trying to ceate a new customer button in an exiting IS-U/CSS CIC (other settings are complete) either in toolbar or in the quick key section to call a customer defined transaction. After copying the Status ISUTEL from Function group EEC

  • JDialog setModal problems

    hi, i have a JDialog that needs to be modal, in the jdialog is a JList that gets filled up with a DefaultListModel after the dialog is instantiated, the problem now is when i have setModal ( true ), the JList doesn't fill up ? Anyone know a solution

  • I can not change the language to englis on my hp envy 7645

    I can not change the language to English on my hp envy 7645 all in one printer.  I have pushed the tools button but it does not say preferences.  It only list about six foreign languages and I have no option for English