Somple question about xml structure

xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<properties>
     <category>
          <timeout>60</timeout>
          <timeout>100</timeout>
</category>
</properties>
and want to use DOM in java to get the nodelist information,
Element root=doc.getDocumentElement();
NodeList nodelist = root.getChildNodes();
for(int i = 0;i<nodelist.getLength();i++)
System.out.println(nodelist.tostring());
System.out.println(nodelist.getLength());
System.out.println(nodelist.getNodeType());
but the output is:
<properties>
     <category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
</properties>
3 //why here the nodelist.length is 3?which 3?
3
<properties>
     <category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
</properties>
3
1
<category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
5 //why is 5? which 5?
3
<category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
5
1
<timeout>60</timeout>
1 //here is just 1?
3
<category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
5
3
<category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
5
1
<timeout>100</timeout>
1
3
<category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
5
3
<properties>
     <category>
          <timeout>60</timeout>
          <timeout>100</timeout>
     </category>
</properties>
3
3
why all the node.getNodeType is 3, 3 means that they are all Text type?
thanks

some wrong.sorry
the code is :
Element root=doc.getDocumentElement();
NodeList nodelist = root.getChildNodes();
for(int i = 0;i<nodelist.getLength();i++)
System.out.println(nodelist.item(i).tostring());
System.out.println(nodelist.item(i).getLength());
System.out.println(nodelist.item(i).getNodeType());
}

Similar Messages

  • Re: Questions about Plan structure

    Reply-To: "Duncan Kinnear" <[email protected]>
    Q. if you have an Employee class with related EmployeeSubordinate and
    EmployeeSalaryHistory classes, should these all be in the same plan?
    A It is better to have them in the same plan.It depends on the design
    you have
    Q Why should the Managers be separated from their business classes?
    A Managers are usually service objects which might require different
    resources.
    These managers when deployed might be required by several other
    applications.
    Seperating them as a different plan will help in just using one
    installed partition to be
    Used by different applications (refer about Reference Partition)
    Q If you have the Database managers separate, what scope does each DB
    manager cover?
    A It is better to have the DB managers in user scope.
    It depends on the numbers of users, u have for the system.
    Since u are talking about 100 tables. It's a huge system.
    It also depends on the user licenses u have for the backend.
    Take care that u use proper load balancing of DB Managers for the
    system.
    Krishna CVSR
    GoldStone Softech Inc
    >
    Hi there,
    We are in the middle of designing the structure of a new system.
    I have read/heard that it is best to break down the plans into the
    following categories:
    Business Classes
    Managers/Services
    Clients
    I have a few questions about this structure:
    Should related business classes be grouped together in Plans? E.g. if
    you have an Employee class with related EmployeeSubordinate and
    EmployeeSalaryHistory classes, should these all be in the same plan?
    Why should the Managers be separated from their business classes?
    E.g. if there is an EmployeeMgr service which deals with anything to do
    with the Employee business class, why separate them in different
    plans? If you need the manager to access the class, you will always
    need both.
    Some of the Forte documentation talks about "Policy" managers and
    "Database" managers. How do the functions of these managers differ
    for a simple CRUD (Create Read Update Delete) class?
    If you have the Database managers separate, what scope does each
    DB manager cover? I.e. do you have one for the entire database (over
    100 tables in our case), or do you break it down by sub-system?
    Thanks in advance for any answers.
    Cheers,
    Duncan Kinnear,
    McCarthy and Associates, Email: [email protected]
    PO Box 764, McLean Towers, Phone: +64 6 834 3360
    Shakespeare Road, Napier, New Zealand. Fax: +64 6 834 3369
    Providing Integrated Software to the Meat Processing Industry for over 10 years
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Reply-To: "Duncan Kinnear" <[email protected]>
    Q. if you have an Employee class with related EmployeeSubordinate and
    EmployeeSalaryHistory classes, should these all be in the same plan?
    A It is better to have them in the same plan.It depends on the design
    you have
    Q Why should the Managers be separated from their business classes?
    A Managers are usually service objects which might require different
    resources.
    These managers when deployed might be required by several other
    applications.
    Seperating them as a different plan will help in just using one
    installed partition to be
    Used by different applications (refer about Reference Partition)
    Q If you have the Database managers separate, what scope does each DB
    manager cover?
    A It is better to have the DB managers in user scope.
    It depends on the numbers of users, u have for the system.
    Since u are talking about 100 tables. It's a huge system.
    It also depends on the user licenses u have for the backend.
    Take care that u use proper load balancing of DB Managers for the
    system.
    Krishna CVSR
    GoldStone Softech Inc
    >
    Hi there,
    We are in the middle of designing the structure of a new system.
    I have read/heard that it is best to break down the plans into the
    following categories:
    Business Classes
    Managers/Services
    Clients
    I have a few questions about this structure:
    Should related business classes be grouped together in Plans? E.g. if
    you have an Employee class with related EmployeeSubordinate and
    EmployeeSalaryHistory classes, should these all be in the same plan?
    Why should the Managers be separated from their business classes?
    E.g. if there is an EmployeeMgr service which deals with anything to do
    with the Employee business class, why separate them in different
    plans? If you need the manager to access the class, you will always
    need both.
    Some of the Forte documentation talks about "Policy" managers and
    "Database" managers. How do the functions of these managers differ
    for a simple CRUD (Create Read Update Delete) class?
    If you have the Database managers separate, what scope does each
    DB manager cover? I.e. do you have one for the entire database (over
    100 tables in our case), or do you break it down by sub-system?
    Thanks in advance for any answers.
    Cheers,
    Duncan Kinnear,
    McCarthy and Associates, Email: [email protected]
    PO Box 764, McLean Towers, Phone: +64 6 834 3360
    Shakespeare Road, Napier, New Zealand. Fax: +64 6 834 3369
    Providing Integrated Software to the Meat Processing Industry for over 10 years
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    Get Your Private, Free Email at http://www.hotmail.com
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Question about XML validation against schema

    My question is probably a basic one about XML. I tried PurchaseOrder example from the book "J2EE Web Services" by Richard Monson-Haefel. A simplified version as followings -
    Address.xsd -
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/Address"
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <element name="address" type="addr:USAddress" />
    <complexType name="USAddress">
    <sequence>
    <element name="name" type="string" />
    <element name="street" type="string" />
    <element name="city" type="string" />
    <element name="state" type="string" />
    <element name="zip" type="string" />
    </sequence>
    </complexType>
    </schema>
    PurchaseOrder.xsd -
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:po="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:ad="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <import namespace="http://xml.netbeans.org/schema/Address" schemaLocation="Address.xsd" />
    <element name="purchaseOrder" type="po:PurchaseOrder" />
    <complexType name="PurchaseOrder">
    <sequence>
    <element name="accountName" type="string" />
    <element name="accountNumber" type="unsignedShort" />
    <element name="shipAddress" type="ad:USAddress" />
    <element name="total" type="float" />
    </sequence>
    <attribute name="orderDate" type="date" />
    </complexType>
    </schema>
    Then PurchaseOrder.xml is -
    <purchaseOrder orderDate="2007-12-12"
    xmlns='http://xml.netbeans.org/schema/PurchaseOrder'
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocation='http://xml.netbeans.org/schema/PurchaseOrder ../xsd/PurchaseOrder.xsd'>
    <accountName>Starwood</accountName>
    <accountNumber>220</accountNumber>
    <shipAddress>
    <name>Data Center</name>
    <street>1501 Washington St.</street>
    <city>Braintree</city>
    <state>MA</state>
    <zip>02148</zip>
    </shipAddress>
    <total>250</total>
    </purchaseOrder>
    Then I did a XML validation but have this error -
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"http://xml.netbeans.org/schema/Address":name}' is expected. [19]
    It complains <name> tag in <shipAddrss> needs namespace of "http://xml.netbeans.org/schema/Address". Why?
    Is it possible to change XML so it does not need name space for elements inside <shipAddress>?
    Thanks

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • Basic questions about NWDI structure

    Hello All,
    I have read some materials about the Java development process within SAP J2EE engine.
    Here I just want to confirm with you some knowledge points and ask some questions about the configuration of NWDI before proceeding Java development.
    1. There are four systems within SAP Java landscape, the first one is the developer's own PC, on which there should be installed SAP Workplace (actually is a small J2EE engine and the NW developer studio), am I understanding right?
    2. Where should the DTR CBS CMS and SLD be installed? on the Consolidation Server? or the TEST Server? or the Production server? or totally on another standalone server?
    3. Within one Track (four system), how many DTR server, CBS Server and SLD server should be installed?  Does it only need one for each?(All the four system connect to the same DTR/CBS/SLD server?)
    4. Can DTR Server, CBS Server and SLD Server be installed on the same host? or should they be installed on separate hosts?
    Thank you very much in advance.
    Best regards,
    Nick

    The introduction of this demo contains a nice overview of the system landscape with NWDI, which should answer most of your questions:
    http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/c0b1f2c8-54e0-2910-9ab3-b85f15093655
    Here's the main page for NWDI here on SDN:
    SAP NetWeaver Development Infrastructure (NWDI)

  • New to mac and iphoto, questions about photo structure & organization

    I bought a new Macbook Pro a couple of days ago and am still figuring things out. I wasn't displeased with windows...I just decided to try a mac anyway, So far, I adore it except for one thing, the pictures.
    I spent hours researching whether to download and use picasa 3 for mac or iphoto. I decided on picasa....and now I've changed my mind. (Mostly because I tried to take pictures of the moon tonight, and they looked great in camera, but Picasa could only pick up a black screen whearas iphoto actually saw and defined the moon- and with the editing software on the two, the picasa auto-edit looked like a picture that was created in microsoft paint, and iphoto came out with a beautifully contrasted photo).
    Now that I decided to use iphoto, I have been researching how to switch and still seem to have a lot of questions. (I've poked around numerous forums but have found conflicting answers on different sites).
    1) I organize my pictures by folders with the month and year. I know iphoto organizes events, which it seems to determine based on photo similarity. Will my photo structure still appear in finder -> pictures?
    2) Is it possible to stop iphoto from organizing my pictures and just trust me on what I want?
    3) All of my friends and family use PCs, and there is a chance that due to financial concerns, when I eventually replace my macbook pro (far in the future) I could switch to a pc. Does iphoto make transferring pictures more difficult? (If I understand correctly, it does not change the photo file, a jpeg is still a jpeg but I want to be sure)
    4) I do not want iphoto to duplicate all of the pictures already in my library....if I import from finder-users-pictures, will it simply use those, or duplicate all 150gb worth of pictures?
    5) Any other tips for someone completely new to macs and iphoto?
    6) This is very silly, but how do I uninstall picasa (I know how to uninstall on a windows but want to make sure I do things correctly on my mac!)
    Also, just a "bonus"- regarding events vs. files I create, will iphoto create events within the program but leave my file structure in the library it imports from alone? If I use finder to go to where I store my photos, will I still see my file structure regardless of what iphoto does?(Does that make sense? I'm having a hard time trying to describe it)
    I apologize if this question is foolish or misplaced- I did read many other posts but didn't see the answers I was looking for.

    Your questions are neither foolish nor misplaced.
    The first thing I strongly suggest is that you make a trial iPhoto Library. Import 100 or 200 pics and explore. Iphoto isn't right for everybody, and if you're going to use it you will need to rethink things a little.
    1) I organize my pictures by folders with the month and year. I know iphoto organizes events, which it seems to determine based on photo similarity. Will my photo structure still appear in finder -> pictures?
    A: Events are based entirely on Date and Time not on 'photo similarity' You can set the interval for what makes an Event in the iPhoto Preferences: iPhoto Menu -> Preferences -> General Pane: Autosplit into Events... And select from the drop down menu.
    Will my photo structure still appear in finder -> pictures?
    Yes or no, depending... iPhoto can run as a Referenced or Managed Library. In the former case, yes you files will be visible in the Finder, in the latter case they won't.
    Note that Referenced or Managed refers +only to file storage+ It offers no extra functionality, it does nothing at all. App like iPhoto are your go-to app for your photos. If you use it, then you never access the photos via the Finder. Ever. It's always via iPhoto or the many, many hooks into the OS that it has.
    I'll detail more on Referenced v Managed below.
    2) Is it possible to stop iphoto from organizing my pictures and just trust me on what I want?
    I'm not sure what you mean by this. Iphoto does basic date and time organisation by default. You can change it, you can change the location of the photos in Events, merge them and then using the other tools available - Albums, Smart Albums, Faces, Places etc you can organise your photos whatever way you want.
    But what do you mean by pictures. There is a distinction between Photos - the image of your child holding his dog - and files: A Jpeg is just a file. Iphoto is designed for you to +forget about the jpeg+ and get on with the interesting bit: the pics of your younger and his pet.
    3) All of my friends and family use PCs, and there is a chance that due to financial concerns, when I eventually replace my macbook pro (far in the future) I could switch to a pc. Does iphoto make transferring pictures more difficult? (If I understand correctly, it does not change the photo file, a jpeg is still a jpeg but I want to be sure)
    A Jpeg is a Jpeg is a Jpeg. If you migrate to another app or an entire OS you can export the photos plus any and all metadata you've added to the Finder and move it on. (Caveat: You cannot export Faces. There is no agreed standard on any system for exchanging this info.)
    4) I do not want iphoto to duplicate all of the pictures already in my library....if I import from finder-users-pictures, will it simply use those, or duplicate all 150gb worth of pictures?
    It can do either. And this brings me back to the Referenced v Managed discussion above. By default, iPhoto will Manage the files, that is, it will copy them into the Library. You can choose not to, but I strongly recommend that you don't:
    *How to do it:*
    Simply go to iPhoto Menu -> Preferences -> Advanced and uncheck 'Copy Files to the iPhoto Library on Import'.
    *What Happens:*
    Now iPhoto will not copy the files, but rather simply reference them on your HD. To do this it will create an alias in the Originals Folder that points to your file. It will still create a thumbnail and, if you modify the pics, a Modified version within the iPhoto Library Folder.
    *Some things to consider:*
    1. Importing and deleting pics are more complex procedures. You have to to put the files where they will be stored before importing them. When you delete them you'll need to remove the files from the HD yourself.
    2. You cannot move or rename the files on your system or iPhoto will lose track of them on systems prior to 10.5 and iPhoto 08. Even with the later versions issues can still arise if you move the referenced files to new volumes or between volumes.
    3. Most importantly, migrating to a new disk or computer can be much more complex.
    4. Because iPhoto has no tools for managing Referenced Files, if, for some reason, the path to the photos changes then you could find yourself resolving aliases for +each photo in the Library+ one by one.
    My own opinion:
    I've yet to see a good reason to run iPhoto in referenced mode unless you're using two photo organisers
    If disk space is an issue, you can run an entire iPhoto Library from an external disk:
    1. Quit iPhoto
    2. Copy the iPhoto Library as an entity from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    If you're concerned about accessing the files, There are many, many ways to access your files in iPhoto:
    *For Users of 10.5 and later*
    You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    You can access the Library from the New Message Window in Mail:
    Uploaded with plasq's Skitch!
    *For users of 10.4 and later* ...
    Many internet sites such as Flickr and SmugMug have plug-ins for accessing the iPhoto Library. If the site you want to use doesn’t then some, one or any of these will also work:
    To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
    This is also true for emailing with Web-based services. However, if you're using Gmail you can use iPhoto2GMail
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    *If you want to access the files with iPhoto not running*:
    For users of 10.6 and later:
    You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and later:
    Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    3. *Show File*: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
    *If you want to edit the photo in another application:*
    You can set Photoshop (or any image editor) as an external editor in iPhoto. (Preferences -> General -> Edit Photo: Choose from the Drop Down Menu.) This way, when you double click a pic to edit in iPhoto it will open automatically in Photoshop or your Image Editor, and when you save it it's sent back to iPhoto automatically. This is the only way that edits made in another application will be displayed in iPhoto.
    5) Any other tips for someone completely new to macs and iphoto?
    *To Push Home a point*
    For someone inexperienced with Macs and inexperienced with iPhoto I cannot stress enough that Managed Library is the way to go. I understand there is comfort in seeing all those folders. But inside the Library that's all there is: all those folders, stored so that an inexperienced user can't grub things up!
    The iPhoto Library Folder is a Package File. This is simply a folder that looks like a file in the Finder. The change was made to the format of the iPhoto library because many users were inadvertently corrupting their library by browsing through it with other software or making changes in it themselves. Want to see inside?
    Go to your Pictures Folder and find the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.
    Standard Warning: Don't change anything in the iPhoto Library Folder via the Finder or any other application. iPhoto depends on the structure as well as the contents of this folder. Moving things, renaming things or otherwise making changes will prevent iPhoto from working and could even cause you to damage or lose your photos.
    Now close that window and forget about it.
    So, once you've imported your photos to iPhoto in a Managed Library, the surplus duplicates are +your folders+. Of course, in time, trash them to get back the wasted disk space. But don't do it today or tomorrow. There's no hurry. When you feel confident that you understand how iPhoto is working and that's it's working for you, theat's the time to reclaim the space.
    I organize my pictures by folders with the month and year.
    If you want to duplicate your Folder Tree in iPhoto:
    Start at the bottom of the hierarchy and drag a folder of images to the Album Heading in iPhoto. The pics will be imported and an Album of the same name created.
    You can then create the Enclosing Folders in the iPhoto Window (File -> New Folder) and drag the Album to it. Folders can contain other Folders (Nested Folders) and Albums.
    However, is your folder system date based? Then this form of organisation is a bit pointless in iPhoto when Smart Albums or the Calendar tool (Click on the wee magnifying glass in the Search Box) mean you can find the photos taken on any day, month or year at a click. With Smart Albums it's easy to find photos from specific range - say, June 3 to August 25, 2009 etc.
    If your folder system is theme based - Xmas pics, Birthday pics etc, then you'll find Keywords are much more flexible, and can be used in conjunction with other criteria for making Smart Albums and searches.
    6) This is very silly, but how do I uninstall picasa (I know how to uninstall on a windows but want to make sure I do things correctly on my mac!)
    Drag the app to the trash and empty it.
    Regards
    TD
    v

  • Question about XML mapping to ABAP internal table

    Hi experts.
    I'm trying to XML mapping. But it doesn't work well. Assume there are XML file as below.
    <HEADER>
      <ITEM>
        <FOO>123</FOO>
        <BAR>ABC</BAR>
      </ITEM>
      <ITEM>
        <FOO>456</FOO>
        <BAR>DEF</BAR>
      </ITEM>
    <HEADER>
    and I want to trasformation it as below.
    ITAB
    FOO       |      BAR
    123         |  ABC
    456         | DEF
    How could I trasformation using "call transformation"?
    Regards.

    Hi,
    REPORT  zind_xml_to_sap NO STANDARD PAGE HEADING.
    Data Declaration                                                    *
    DATA: client      TYPE REF TO if_http_client, "Interface
          host        TYPE string,
          port        TYPE string,
          proxy_host  TYPE string,
          proxy_port  TYPE string,
          path        TYPE string,
          scheme      TYPE i,
          xml         TYPE xstring,
          response    TYPE string.
    DATA: t_xml       TYPE smum_xmltb OCCURS 0 WITH HEADER LINE.  "XML Table structure used
                                                                  "for retreive and output XML doc
    DATA: g_stream_factory TYPE REF TO if_ixml_stream_factory.    "Interface
    DATA : return  LIKE  bapiret2 OCCURS 0 WITH HEADER LINE.      "XML Table structure used for retreive
                                                                  "and output XML doc
    Parameters                                                          *
    PARAMETER : p_add TYPE string LOWER CASE ,
                p_dfile   LIKE rlgrap-filename.
    AT Selection-Screen on value-request for file                       *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
    Get file
      PERFORM 100_get_file.
    Start-of-Selection                                                  *
    START-OF-SELECTION.
    Perform to upload xml data from URL to SAP internal table
      PERFORM 200_xml_upload.
      IF t_xml[] IS NOT INITIAL.
      Perform to Download data from Internal Table to a text file in local drive
        PERFORM 300_download.
        write : / 'Data Uploaded to Internal Table Successfully'.
        write : / 'XML Data Downloaded to Local path', p_dfile.
      else.
        write : / 'No Data for upload'.
      ENDIF.
    *if t_xml[] is INITIAL.
    WRITE : address, 'Given URl cannot be Converted' .
    else.
    LOOP AT t_xml .
       WRITE:  t_xml-cname, t_xml-cvalue.
    ENDLOOP.
    endif.
    *&      Form  get_file
          Get File
    FORM 100_get_file .
      CALL FUNCTION 'F4_FILENAME'
      EXPORTING
        PROGRAM_NAME        = SYST-CPROG
        DYNPRO_NUMBER       = SYST-DYNNR
        FIELD_NAME          = ' '
       IMPORTING
         file_name           = p_dfile
    ENDFORM.                    " 100_get_file
    *&      Form  200_xml_upload
          form to upload xml data from URL to SAP internal table
    FORM 200_xml_upload .
    *Check HTTP:// and concatenate
      IF p_add NS 'http://' OR p_add NS 'HTTP://'.
        CONCATENATE 'http://' p_add
                    INTO p_add.
      ENDIF.
    Fetching the address of the URL
      CALL METHOD cl_http_client=>create_by_url
        EXPORTING
          url    = p_add
        IMPORTING
          client = client.
    *Structure of HTTP Connection and Dispatch of Data
      client->send( ).
    *Receipt of HTTP Response
      CALL METHOD client->receive
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2
          http_processing_failed     = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        IF sy-subrc = 1.
          MESSAGE 'HTTP COMMUNICATION FAILURE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 2.
          MESSAGE 'HTTP INVALID STATE' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSEIF sy-subrc = 3.
          MESSAGE 'HTTP PROCESSING FAILED' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ELSE.
          MESSAGE 'Problem in HTTP Request' TYPE 'I' DISPLAY LIKE 'E'.
          EXIT.
        ENDIF.
      ENDIF.
    Get data of the xml to Response
      response = client->response->get_cdata( ).
    *FM converting the XML format to abap
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = response
        IMPORTING
          buffer = xml.
    *FM converting XMl to readable format to a internal table.
      CALL FUNCTION 'SMUM_XML_PARSE'
        EXPORTING
          xml_input = xml
        TABLES
          xml_table = t_xml
          return    = return.
    ENDFORM.                    " 200_xml_upload
    *&      Form  300_download
    *form to Download data from Internal Table to a text file in local drive
    FORM 300_download .
      DATA filename TYPE string.
      filename = p_dfile.
      CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = filename
        WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        data_tab                        = t_xml
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
      IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.

  • Question about xml schemas and the use of unqualified nested elements

    Hello,
    I have the following schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://xml.netbeans.org/examples/targetNS"
        targetNamespace="http://xml.netbeans.org/examples/targetNS"
        elementFormDefault="unqualified">
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="age" type="xsd:int"/>
        <xsd:element name="person">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element ref="name"/>
                    <xsd:element ref="age"/>
                   <xsd:element name="height" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>I am just wondering why would someone have a nested element that is unqualified? here the "height" element.
    Can anyone explain this to me please?
    Thanks in advance,
    Julien.
    here is an instance xml document
    <?xml version="1.0" encoding="UTF-8"?>
    <person xmlns='http://xml.netbeans.org/examples/targetNS'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:schemaLocation='http://xml.netbeans.org/examples/targetNS file:/E:/dev/java/XML/WebApplicationXML/web/newXMLSchemaThree.xsd'>
    <name>toto</name>
    <age>40</age>
    <height>180</height>
    </person>

    Don't worry about it.
    There are two different styles of schemas. In one style, you define the elements, attributes, etc. at the top, and then use the "ref" form to refer to them. (I call this the "global" style.) The other style is to define elements inline where they are used. ("local" style)
    Within some bounds, they work the same and which you use is a choice of you and the tools that generate the schemas.
    A warning about the local style. It is possible to define an element in two different locations in the schema that are different. It will get past all schema validation, but it seems wrong to my sense of esthetics. With the global style, this will not happen.
    So, how did this happen? Probably one person did the schema when it only had a name and age. Then, someone else added the height element. They either used a different tool, or preferred the other style. I'm aware of no difference in the document you have described between the two styles.
    Dave Patterson

  • Question about program structure.

    hi, I am trying to write a GUI program like MSN messenger. right now, I am really confused about my program structure.
    Should I put all the things in one class or separate them into GUI class, services class..etc? for example, right now, I have a class responsible for connecting to the server. Should I put it into the GUI class as a nested class or .......? Basically, what is the best structure for GUI program?

    new_java-sun wrote:
    thank you very much. Do you know why the mvc pattern is called mvc pattern instead of DGC(data-gui-controller) pattern?Because a view need not be a GUI, or even a UI, and a model need not be data

  • ODI and Essbase - question about updating structure (temp otls)

    Hi,
    versions:
    ODI 11.1.1
    essbase 11.1.2.2.1 (linux)
    I'm running an interface that intends to update a dimension structure with the data from my respective dimension in Oracle relational. Actually a pretty simple interface using the KM "IKM SQL to
    Hyperion Essbase (METADATA)". The execution is running fine with no errors and the structure is updated as expected, however we noticed that there are otl files being created in a tmp folder and they're never deleted. This folder is in the essbase server (/tmp). If I run this interface many times in a day, I'll have as many files in this folder as executions I did. So my question is if anybody knows why those files are being created and why they are not removed from there when the interface execution ends.
    Thinking ahead, I'll have to create a shell script to clean up this folder in order to never have storage issues with those temporary otl files.
    Thanks in advance for any contributions
    Eduardo

         Agreed.     
         I also think those files were created by the java APIs. Just for testing purposes, I ran the rule manually and those otls were not created. This is one more reason for me to believe on this theory.
         However, what makes me think is: no one else got this issue? What are you guys doing with those files?
         Maybe there is some setup I have to do and those files will not be created anymore.
    Thanks,
    Eduardo

  • Simple question about table structure and HR in BW

    i need to following data from HR:
    current FTE, employee number, cost place
    i dont think the current FTE is stored per employee. Therefor is would need a list that contains:
    mutation start date, mutation end date, FTE, employee, cost place
    i think cost place is a custom field.
    my question : what tables names and field names do i need?
    Thanks in advanced

    Hi,
    For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
    Hope this helps...
    Thanks,

  • Question about XML file transferring over the networking

    Hi, I am now to Java, and now I am going to set up a simple network in the lab.
    I have created a random array of data and transferred to XML file on my client. Now, I would like to send it to the server. I am wondering how I can put the XML file into my client, and do I need any parser to let the server show what random date it has received?
    Anybody can give me any idea or some basic code? Thank you.
    Now, I am referring the KnockKnock example in Java online tutorial. But, not clear how to deal with the XML File.
    Fengyuan

    Four crossposts.
    http://forum.java.sun.com/thread.jspa?threadID=5158198&messageID=9600070#9600070
    http://forum.java.sun.com/thread.jspa?threadID=5158200&messageID=9600074#9600074
    http://forum.java.sun.com/thread.jspa?threadID=5158201&messageID=9600076#9600076
    http://forum.java.sun.com/thread.jspa?threadID=5158202&messageID=9600078#9600078

  • Question about database structure - best practice

    I want to create, display, and maintain a data table of loan
    rates. These
    rates will be for two loan categories - Conforming and Jumbo.
    They will be
    for two loan terms - 15year and 30year. Within each term,
    there will be a
    display of -
    points (0, 1, 3) - rate - APR
    For example -
    CONFORMING
    30 year
    POINTS RATE APR
    0 6.375 6.6
    1 6.125 6.24
    3 6.0 6.12
    My first question is -
    Would it be better to set up the database with 5 fields
    (category, term,
    points, rate, apr), or 13 fields (category, 30_zeropointRate,
    30_onepointRate, 30_threepointRate, 30_zeropointAPR,
    30_onepointAPR,
    30_threepointAPR, 15_zeropointRate, 15_onepointRate,
    15_threepointRate,
    15_zeropointAPR, 15_onepointAPR, 15_threepointAPR)?
    The latter option would mean that my table would only contain
    two records -
    one for each of the two categories. It seems simpler to
    manage in that
    regard.
    Any thoughts, suggestions, recommendations?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================

    Thanks, Pat. I'm pretty sure that this is a dead-end
    expansion. The site
    itself will surely expand, but I think this particular need
    will be
    informational only....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Pat Shaw" <[email protected]> wrote in message
    news:[email protected]...
    > But if the site ever wants to expand on it's
    functionality etc. it can be
    > very difficult to get round a de-normalised database.
    You can find that
    > you have tied yourself in knots and the only solution is
    to go back and
    > redesign the database which often includes major
    redesigning of the
    > fron-end too.
    >
    > If you are confident that this will not be the case then
    go with your
    > initial thoughts but don't be too lenient just in case.
    Leave yorself a
    > little scope. I always aim for 3rd normal form as this
    guarantees a robust
    > database design without being OTT.
    >
    > Pat.
    >
    >
    > "Joris van Lier" <[email protected]> wrote in
    message
    > news:[email protected]...
    >>
    >>
    >> "Murray *ACE*"
    <[email protected]> wrote in message
    >> news:[email protected]...
    >>> I want to create, display, and maintain a data
    table of loan rates.
    >>> These rates will be for two loan categories -
    Conforming and Jumbo.
    >>> They will be for two loan terms - 15year and
    30year. Within each term,
    >>> there will be a display of -
    >>>
    >>> points (0, 1, 3) - rate - APR
    >>>
    >>> For example -
    >>>
    >>> CONFORMING
    >>> 30 year
    >>> POINTS RATE APR
    >>> ----------- --------- ------
    >>> 0 6.375 6.6
    >>> 1 6.125 6.24
    >>> 3 6.0 6.12
    >>>
    >>> My first question is -
    >>>
    >>> Would it be better to set up the database with 5
    fields (category, term,
    >>> points, rate, apr), or 13 fields (category,
    30_zeropointRate,
    >>> 30_onepointRate, 30_threepointRate,
    30_zeropointAPR, 30_onepointAPR,
    >>> 30_threepointAPR, 15_zeropointRate,
    15_onepointRate, 15_threepointRate,
    >>> 15_zeropointAPR, 15_onepointAPR,
    15_threepointAPR)?
    >>>
    >>> The latter option would mean that my table would
    only contain two
    >>> records - one for each of the two categories. It
    seems simpler to
    >>> manage in that regard.
    >>>
    >>> Any thoughts, suggestions, recommendations?
    >>
    >> In my opinion, normalizing is not necessary with
    small sites, for example
    >> the uber-normalized database design I did for the
    telcost compare matrix
    >> (
    http://www.artronics.nl/telcostmatrix/matrix.php
    ) proved to be totally
    >> overkill.
    >>
    >> Joris
    >
    >

  • General question about xml

    Hi,
    How can I "include" xml file to another xml file?
    I want to different in one xml file some header reports...for once!!!
    then to call (include) from all athers xml files to this header.
    (instead all the time to write the same rows.. :))
    Thanks.
    I'm new in xml topic.

    XSLT seems to be your choice, but standard API's can also be used for this purpose.

  • Question about XML DOM de-bugging.

    I have programmed the following class as an excercise in using the DOM and in recursion.
    I'm having trouble,however, in debugging my iterate() method.
    Sometimes it fails to print certain outer tags.
    I'm faily confident there aren't any problems in using entirely static methods in the class.
    I simply want it to iterate over all Nodes in the xml document,
    and print them to the file in correct order.
    Is there anyone out there who could debug my iterate() method?
    import org.w3c.dom.*;
    import javax.xml.parsers.*;
    import java.io.*;
    public class DomParsing {
    private static PrintStream stream;
    public static void main (String [] args)
    try
    DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = builderFactory.newDocumentBuilder();
    File file = new File("cd-catalog.xml");
    Node child = null;
    Document document = builder.parse(file);
    Node element = (Node)document.getDocumentElement();
    stream = new PrintStream(new File("SCREEN_OUTPUT.txt"));
    iterate(element);
    stream.close();
    catch (Exception e)
    {e.printStackTrace();}
    public static void iterate(Node element) //bug in this method.
    if(element instanceof Node)
    peekNode(element);
    peekAttributes(element);
    Node [] children = getChildren(element);
    if(children instanceof Node[])
    for(int i=0;i<children.length;i++)
    iterate(children);
    element = getSibling(element);
    if(element instanceof Node)
    iterate(element);
    else {
    return;}
    private static Node [] getChildren(Node element)
    Node [] children = null;
    if(element.hasChildNodes()){
    NodeList nodes= element.getChildNodes();
    children = new Node [nodes.getLength()];
    for(int i=0;i<nodes.getLength();i++)
    {children[i] = nodes.item(i);}
    return children;}
    private static Node getSibling(Node element)
    return element.getNextSibling();}
    private static void peekNode(Node node)
    if((node instanceof Node) && (stream instanceof PrintStream))
    if(node.getNodeName()!=null && (!node.getNodeName().equals("#text")))
    {stream.println(new String(node.getNodeName()));
    if(node.getNodeValue()!=null)
    {stream.println(new String(node.getNodeValue()));
    private static void peekAttributes(Node element)
    if(element.hasAttributes())
    NamedNodeMap map = element.getAttributes();
    for(int i=0;i<map.getLength();i++)
    Attr attribute = (Attr)map.item(i);
    peekNode((Node)attribute);}

    Never fear, Ihave found my answer!
    I had unwitingly disasociated recursive steps,
    instead of correctly associated.
    The following runs correctly in
    all my instances:
       import org.w3c.dom.*;
       import javax.xml.parsers.*;
       import java.io.*;
       import java.util.*;
        public class DomParsing {
        //Main method call to leverage the Iterator Class.
           public static void main (String [] args)
             Iterator iterator = new Iterator("tomcat-users.xml");
        class Iterator {
          private LinkedList<String> myDocument;
          //private  PrintStream stream; 
            //Constructor accesses xml file for parsing work.
           public Iterator (String fileName)
             try{
                DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = builderFactory.newDocumentBuilder();
                File file = new File(fileName);
                Node child = null;
                Document document = builder.parse(file);
                Node element = (Node)document.getDocumentElement();
                //stream = new PrintStream(new File("SCREEN_OUTPUT.txt"));
                myDocument = new LinkedList<String>();
                System.out.println("___________________________________________________");
                iterate(element);  
               //stream.close();               
                ListIterator<String> nodes = myDocument.listIterator();
                while(nodes.hasNext())
                   System.out.println(nodes.next().trim());
                System.out.println("___________________________________________________");
                 catch (Exception e)
                {e.printStackTrace();}
          //This method is intended to be called recursively
            //to set up a "tree" arrangement in memory
            //representing an xml document tree.
           private void iterate(Node element)       {
             if (element == null)
                return;
             if(element instanceof Node)
                peekNode(element);
                peekAttributes(element);
                Node [] children = getChildren(element);
                if(children instanceof Node[])
                   for(int i=0;i<children.length;i++)
                      iterate(children);
    Node sibling = getSibling(element);
    if(sibling instanceof Node)
    {iterate(sibling);}
    //Returns array of all Children Nodes of an Element.
    private Node [] getChildren(Node element)
    Node [] children = null;
    if(element.hasChildNodes()){
    NodeList nodes= element.getChildNodes();
    children = new Node [nodes.getLength()];
    for(int i=0;i<nodes.getLength();i++)
    {children[i] = nodes.item(i);}
    return children;}
    //Obtains the next Sibling element
    private Node getSibling(Node element)
    return element.getNextSibling();}
         //These print any Node and any data,
         //from Element,attribute,attribute values,
         //sibling,child, etc..
    private void peekNode(Node node)
    if((node instanceof Node))// && (stream instanceof PrintStream))
    if(node.getNodeName()!=null && (!node.getNodeName().equals("#text")))
    {//stream.println(new String(node.getNodeName().trim()));
    myDocument.add(node.getNodeName().trim());
    //System.out.println(node.getNodeName().toString());
    if(node.getNodeValue()!=null)
    {//stream.println(new String(node.getNodeValue().trim()));
    myDocument.add(node.getNodeValue().trim());
    //System.out.println(node.getNodeValue().toString());
         //This examines the xml attributes on and element node.
    private void peekAttributes(Node element)
    if(element.hasAttributes())
    NamedNodeMap map = element.getAttributes();
    for(int i=0;i<map.getLength();i++)
    Attr attribute = (Attr)map.item(i);
    peekNode((Node)attribute);}

  • Some question about discount structure

    Hi expert:
    Unfortunately a BAPI does not exist for sales deals(VB21).So i need find out a function that can be return the discount structure(sales deals).Who has the experience of this aspect? And whether has the standard structure(the discount structure) in SAP?thanks.
    Regard,
    Kelvin

    A timeout event will work better, especially if the timeout needs to be interruptable to handle other tasks.
    If othere events are triggered, you could recalculate the timeout as shown in my example posted in the following thread: http://forums.ni.com/ni/board/message?board.id=170&message.id=150369
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for