Help with document builder / parser

is there a way to change this to a url
Document doc = parser.parse(new File("foo.xml"));
because when i do
parse(new url("
theres no method
same with new file(new url
help please

public class aaa{
public static void main(String[] args)
try{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder parser = dbf.newDocumentBuilder();
//Document doc = parser.parse(new File("foo.xml")); // the XML document the content of which you want to print
Document doc = parser.parse(new URL("http://www.youtube.com/api2_rest?method=http://somthing&video_id=R98qC0fd_1w"));
String tagName = "siteurl"; // the tag name of the nodes, e.g. "siteurl" or "publisher"
org.w3c.dom.NodeList nodeList = doc.getElementsByTagName(tagName); // all of the nodes having the specified tag name
for (int i = 0; i < nodeList.getLength(); i++) {
  System.out.println(tagName+" "+nodeList.item(i).getTextContent().trim());
catch(Exception e){System.out.println(e);}
}forgot to say its a xml parse
Message was edited by:
aaa801

Similar Messages

  • Document document = builder.parse does not go in correct folder

    Hi,
    In code my directory is set to
    File directory = new File("C:\\java_training\\com\\XMLtoExcel\\orm\\");
    when parsing
    public void generateExcel(ArrayList<String> array1) throws XPathExpressionException {
      //System.out.println("in generateexcel " +array1);
      for (int i = 0; i < array1.size(); i++) {
      try {
      HSSFWorkbook wb = new HSSFWorkbook();
      HSSFSheet spreadSheet = wb.createSheet("spreadSheet");
      System.out.println("in generateexcel " + array1.get(i));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document document = builder.parse(array1.get(i));
      document.getDocumentElement().normalize();
    When executing   Document document = builder.parse(array1.get(i)); returns the following error
    IOException C:\java_training\com\XMLtoExcel\AccountBenefitActionSet.orm.xml (The system cannot find the file specified)
    my directory structure is C:\java_training\com\XMLtoExcel\orm
    but the parse does C:\java_training\com\XMLtoExcel\
    Pleases can I know how to resolve this issue.

    Hi,
    When uploading files without filling in some required columns, the files would appear in “Checked Out Files” page.
    To avoid this situation, you can modify that windows application to force users fill in the required columns or just define default values for those columns.
    You can take a look at the link below for more information:
    http://dlairman.wordpress.com/2013/03/13/favorite-sharepoint-feature-this-week-manage-files-which-have-no-checked-in-version/
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • I need help with document in email

    Need help with document  from email

    Have you updated to the latest version of Adobe Reader? Have you read the Help file in Reader about bringing PDFs from an email?

  • SRM PPS with Document Builder

    Hi,
    We installed SRM 7.0 SP8 with PPS.
    How do I activate Document Builder. As per configuration guide i didn't see /IPRO/FND_DOCUMENT_BUILDER business function.
    Couple of Question
    1. Is it Add-On installation required for Document Builder ?
    2. What is the latest version of Document Builder ?
    3. How do I check whether document builder installed on my system ? Which parameter needs to check ?
    4. How do I check the version of Document Builder on my system ?
    Thanks a lot

    That's the issue, As per configuration guide needs to activate /IPRO/FND_DOCUMENT_BUILDER business function. But I don't see that business function on SFW5.
    But I activated both PPS function already.
    Edited by: Laasya.Pat on Nov 29, 2010 8:47 PM

  • AUR helper with download/build only option ?

    Hi,
    Currently I have a cron job that does this:
    pacman -Syuw --noconfirm
    This downloads all packages and put it in the cache in the background, this way when a run an upgrade I just have to validate.
    I would like to have the same for AUR packages. Is anyone aware of a AUR helper with a "download+build" only option ?

    pacaur (which uses cower) supports a -d flag to download only, and a -m flag to download and build. The -d flag will pull down dependencies. I'm quite happy with pacaur+cower as a day to day solution, $0.02.
    EDIT: sorry I meant the -m flag pulls down deps -- to do it with the -d flag you have to specify it twice. </bourbon>
    Last edited by TE (2014-12-13 00:53:36)

  • SRM 7.0 with Document Builder

    Hi Experts,
    We have a SRM 7.0 with PPS. We want  to use Document Builder  function.  We could find the Document Builder  node in IMG (tcd spro).
    According to the Business Scenario Configuration Guide of SAP Document Builder, it seems we need install PSDOCB 300 add-on. But I couldn't find the PSDOCB 300 add-on in SMP( no authorization?).
    Should I install PSDOCB 300 or Document Builder is already  build-in?
    If I should install PSDOCB 300,where I can find it, pls show me the download path?
    If Document Builder is already  build-in, what should I do to show the node in IMG?
    Thanks!
    SRM 7.0
    NW7.01
    PPS is actived

    Hi Jay,
    I made a double check, there is no Document Builder node under IMG >>Cross-application Components in our SRM system.
    Is there any components we didn't install?
    BTW  : we have Integration with SAP Document Builder node .
    The following is installed sofeware components in our SRM system:
    SAP_ABA             701     0007     SAPKA70107     Cross-Application Component
    SAP_BASIS             701     0007     SAPKB70107     SAP Basis Component
    PI_BASIS             701     0007     SAPK-70107INPIBASIS     Basis Plug-In
    ST-PI         2008_1_700     0000     -     SAP Solution Tools Plug-In
    SAP_BS_FND       701     0008     SAPK-70108INSAPBSFND SAP Business Suite Foundation
    SAP_BW             701     0007     SAPKW70107     SAP Business Warehouse
    SAP_AP             700     0021     SAPKNA7021     SAP Application Platform
    SRM_PLUS             700     0009     SAPKIBK209                          SRM_PLUS for mySAP SRM
    SRM_SERVER      700     0009     SAPKIBKV09     SRM_SERVER
    SRM_EXPL             700     0009     SAPK-70009INSRMEXPL     SRM Extended Functionality for SRM_PLUS including PPS
    SRM_EXT             700     0009     SAPK-70009INSRMEXT     SRM Extended Functionality for SRM_SERVER including PPS
    VIRSANH          530_700     0011     SAPK-53311INVIRSANH     SAP GRC Access Controls 5.3 for 700 HR a

  • Help with conditional build expressions

    I'm using RoboHelp HTML and creating WebHelp Pro layouts. I
    want to create five (or more) different versions of the Help tool
    for our various groups of users.
    Here's what I'd like to do: Create a conditional build tag
    for each of the versions (i.e. each of our groups of users). I
    could name them as follows:
    group1
    group2
    group3
    group4
    group5
    Then, I would associate each topic with one or more of the
    build tags. For example, topic1 may be for group1 and group2;
    topic2 may be for group1 and group4. Etc.
    The problem is thus: When I want to create the version for,
    say, group1, my expression ends up excluding the other groups. In
    the end, this omits any topics associated with group1 that are also
    associated with the other build tags (i.e. the other groups).
    Is there an expression I can use to prevent these topics from
    being omitted? Perhaps the use of parentheses?
    The only solution I've used is tedious: I create many build
    tags--one for each variation. For example, I'd have a
    group1group2group3 build tag, a group1group3 build tag, a
    group1group4 build tag, etc. Then, I just associate one build tag
    with each topic. When I'm creating a version for group1, for
    example, I'd just include all topics with a build tag that includes
    group1 (e.g. group1, group1group3, group1group2group3, et. al.). I
    omit the others (e.g. group2group3, group2group4,
    group2group3group4group5...et. al.).
    As you can imagine, this solution is problematic. First, I
    have to create and keep track of many many build tags. Then, if I
    want to create another version of Help, I need to change all the
    build tags to include this new group.
    I'm sure there must be a better build tag expression for what
    I'm trying to accomplish. Please help! Thanks!

    There is indeed an expression! Unfortunately, the option is
    normally hidden, so it can be tricky to find. Here's what you do:
    1. Define the build tags.
    2. Apply them to your topics. OVERLAPPING IS ENCOURAGED! That
    is to say, you can assign tag1, tag2, and tag3 to a single topic.
    3. Right-click the desired layout and select Properties.
    4. Click the Define button to the right of the Conditional
    Build Tag drop-down menu. The Define Conditional Build Tag
    Expression dialog will appear.
    5. Click the Advanced button. The Advanced area will appear
    at the bottom of the dialog.
    6. Select a tag from the Available Conditional Build Tags
    drop-down menu.
    7. Click the Add Tag button. The selected tag will appear in
    the Conditional Build Tag Expression display window.
    8. Click the AND button.
    9. Select another tag from the drop-down menu.
    10. Click the Add Tag button.
    11. Repeat steps 8-10 for each tag you wish to add to the
    expression.
    12. Click the OK button to close the dialog.
    13. Click the Save button to save your layout with the new
    build expression.
    That's it! The trick is to use the ADVANCED button in the
    Define Conditional Build Tag Expression dialog. Doing so allows you
    to build inclusional expressions rather than exclusional
    expressions, so you can avoid the hassle you described in your
    post. Using this method, I defined two build tags (A and B) and
    applied them to three topics as follows:
    * Topic 1: Tag A
    * Topic 2: Tag B
    * Topic 3: Tags A and B
    I then defined an expression that simply included tag A. When
    I compiled my help, topics 1 and 3 appeared in the output, but
    topic 2 did not.

  • Need help with error: XML parser failed: Error An exception occurred! Type:......

    <p>Need help with the following error.....what does it mean....</p><p>28943 3086739136 XML-240304 3/7/07 7:13:23 PM |SessionNew_Job1<br /><font color="#ff0000">28943 3086739136 XML-240304 3/7/07 7:13:23 PM XML parser failed: Error <An exception occurred! Type:UnexpectedEOFException, Message:The end of input was not expected> at</font><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM line <7>, char <8> in <<?xml version="1.0" encoding="WINDOWS-1252" ?><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfigurations><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <DSConfiguration default="true" name="Configuration1"><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <case_sensitive>no</case_sensitive><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <database_type>Oracle</database_type><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_alias_name1>ODS_OWNER</db_alias_name1><br />28943 3086739136 XML-240304 3/7/07 7:13:23 PM <db_ali>, file <>.<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM |SessionNew_Job1<br />28943 3086739136 XML-240307 3/7/07 7:13:23 PM XML parser failed: See previously displayed error message.</p><p>Any help would be greatly appreciated.  It&#39;s something to do with my datasource and possibly the codepage but I&#39;m really not sure.</p><p>-m<br /></p>

    please export your datastore as ATL and send it to support. Somehow the internal language around configurations got corrupted - never seen before.

  • Need help with expression builder issue

    Hi all
    I'm hoping someone can help with an issue I'm having. I'm creating a database for a manufacturing joinery. For 1 of my forms, Ive to create a despatch form which includes order details along with customer details. Some customers can have contracts in which
    they get a fixed price on certain item. This is where the problem lies.
    For my customers table, I have a field called "On contract" which is a Yes/No field. I've created a query to attempt to make this form. I'm having trouble with adding a total column at the end of this query. Quantity,Unit Price, Contract Price
    are also in the query. I've been trying to build an expression to say like;
    iif [on contract] = "Yes", [Quantity] * [Contract Price]
    iif [on contract] = "no", [Quantity] * [Unit Price]
    It obviously wont work, what am I doing wrong?
    Thanks in advance

    Hi,
    Assuming you are using the database is SQL Server:
    SELECT [CustomerID]
    ,[Quantity]
    ,[Unit Price]
    ,[Contract Price]
    ,[Total] = CASE WHEN [On Contract] = 'Yes' THEN [Quantity] * [Contract Price]
    WHEN [On Contract] = 'No' THEN [Quantity] * [Unit Price] END
    FROM [Customers]
    Modify the SQL to suit your need.
    Hope this helps.
    ~J.

  • Need help with PC build for use with Photoshop CS4 Extended - Have I made the right choices?

    Hello,
    I'm very new to the inner workings of a PC...this will be first time building one from scratch.  I know enough to be dangerous but not enough to be confident.  I will use the PC primarily for editing, secondarily for iTunes management.  I've heard that I should have, at the very least, an SSD for PS, other apps and the O/S.  I'll also have a hard drive for data storage.  Do I need yet another SSD for scratch?  If so, any recs for one?  Also, my current build (which does not include any SSDs) is about $800.  What can I skinny down, without sacrificing a huge amount of speed/performance?  I am looking for major guidance here...I'm ready to order, but I keep second-guessing my choices.  I want to make sure I get this right the first time around.  I want this machine to last me a good long while.  Any help at all will be HUGELY appreciated! 
    Here are my current picks:
    Part list permalink: http://pcpartpicker.com/p/1bwi
    Part price breakdown by merchant: http://pcpartpicker.com/p/1bwi/by_merchant
    CPU: Intel Core i5-2500K 3.3GHz Quad-Core Processor  ($214.99 @ SuperBiiz)
    Motherboard: Gigabyte GA-P67A-D3-B3 ATX  LGA1155 Motherboard  ($104.99 @ Newegg)
    Memory: G.Skill Ripjaws Series 16GB (4 x 4GB) DDR3-1333 Memory  ($85.00 @ Newegg)
    Hard Drive: Samsung Spinpoint F3 1TB 3.5" 7200RPM Internal Hard Drive  ($49.99 @ Newegg)
    Video Card: XFX Radeon HD 6850 1GB Video Card  ($129.99 @ Newegg)
    Case: Cooler Master Elite ATX Mid Tower Case  ($60.00 @ Amazon)
    Power Supply: Corsair 500W ATX12V Power Supply  ($49.99 @ Newegg)
    Optical Drive: Lite-On iHAS124-04 DVD/CD Writer  ($19.99 @ SuperBiiz)
    Operating System: Microsoft Windows 7 Home Premium SP1 (64-bit)  ($91.98 @ Amazon)
    Total: $806.92
    (Prices include shipping and discounts when available.)
    (Generated 2011-09-19 18:29 EDT-0400)
    Thanks!
    Andrea

    Make sure the motherboard is the third revision as the earlier two had problems with the i5-2500K (Sandy Bridge)
    I prefer Asus motherboards but doesn't mean the Gigabyte is a problem. (I note that it scored 4 eggs...)
    May not make a difference in Photoshop but for Premiere the Geforce video cards with GDDR5 are preferred.
    The LiteOn iHas 224 does lightscribe which is a nice touch for clients/gifts.
    There is no room to save as I would consider your build minimum specs for a nice photoshop experience.
    As for SSD drives...my research of reviews and articles makes me feel the technology is not ready for mission critical work. So if you are running a business then I recommend not using SSD drives. Rather look at Raptor 10,000 rpm drive for Windows and Photoshop and use the Spinpoint for storage. If not business then I've read the intel x25 SSD drives are solid but I have no personal experience with them.
    Cheers,
    Steve

  • Can Document Builder parse an XML file from a URL?

    Warning: Java newbie here...
    My problem is that I am able to parse an XML file if it is copied into my project, but not if it is a full URL. Here is what I got so far, that works.
    import java.io.*;
    import java.net.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    try {
        File file = new File("path/to/file.xml");
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.parse(file);
        doc.getDocumentElement().normalize();
        NodeList nodeLst = doc.getElementsByTagName("Names");
        for (int s = 0; s < nodeLst.getLength(); s++) {
            Node parentNode = nodeLst.item(s);
            if (parentNode.getNodeType() == Node.ELEMENT_NODE) {
                Element parentElmnt = (Element) parentNode;
                NodeList nameElmntLst = parentElmnt.getElementsByTagName("Name");
                //etc.
    } catch (Exception e){
        e.printStackTrace();
    }So building off of this I have tried to parse an input stream like this:
    URL url = new URL("http://example.com/file.xml");
    InputStream is = url.getInputStream();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(is);which gives me the following error
    [Fatal Error] :-1:-1: Premature end of file.
    LOG: HME receiver connected
    org.xml.sax.SAXParseException: Premature end of file.
    I also even tried to write the file locally like this:
    URL url = new URL("http://example.com/file.xml");
    HttpURLConnection urlcon = (HttpURLConnection) url.openConnection();
    urlcon.connect();
    InputStream is = urlcon.getInputStream();
    File file = new File("path/to/file.xml");
    OutputStream out = new FileOutputStream(file);
    byte buf[] = new byte[1024];
    int len;
    while((len=is.read(buf))>0)
        out.write(buf,0,len);
    out.close();
    is.close();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(file);This gives the same error.
    If anyone can point me in the right direction I would forever thankful. I've tried search Google and the Sun forums, but haven't quite found the solution. I think it is because I need to try something else completely. Thank you for reading.
    ~~~~ Jeremy

    jmose wrote:
    If I copy the page, it works as shown in the first code block. In the third codeblock the file is never even created, so I cannot tell if that works or not.So: having the parser access the URL fails, and having some other Java code access the URL also fails in the identical way? That suggests the problem is simply accessing the URL via Java code. Presumably when you downloaded the data from the URL, you used a browser to do it and not wget or something like that?

  • Help with Document Size

    Hi. When I set my document size to A4 and then click to view actual size, the page size does not appear as large as A4 on the screen. The image appears smaller than true A4 size. Can anyone help?

    Your first and biggest mistake is in assuming that page sizes on screen are "real". Though there are some adjustments that can be used in some apps, it basically is unconnected. It's just "a size". On screen you might be able to show a ruler: use that, not a real ruler.
    If you have tried to solve and fix this (not real) problem you may have created a real problem with printing.
    There are also sometimes issues with scaling when you print.
    But I agree, if you just want to print, don't export a JPEG. If you must export a JPEG and use it in some other app, then the rules of that other app become important.

  • Help with Query Builder

    Hi,
    I am trying to get a daily statistics of failed instances using Query Builder. I tried to use fields like SI_UPDATE_TS and SI_STARTTIME to filter instances with in a date range, but date range functions does not seem to work. Is there documentation somewhere as to which fields can be used or how the query should be formatted to get results like this?
    Thanks
    Ajith

    Hello Ajith,
    The Query Builder interface is actually rather limited, as you have found out yourself. I don't know if you have any programming experience, but the Query Builder is nothing more than an interface which will use the SDK in the background to talk to the CMS. In other words, if you know how to program for your BO XI deployment (Java or .NET), you can write the logic necessary to retrieve whatever information you want. You'll also find that the SDK documentation contains an explanation (though sometimes limited) for the properties and members that are available.
    Although using the SDK might seem overwhelming at first, it's actually quite easy and far more powerful than the Query Builder alternative. Also, Business Objects hosts quite a few code samples that should easily get you started. There's also a dedicated SDK forum for all specific issues relating to development.
    Some links to get you up and running:
    [Developer Library|https://boc.sdn.sap.com/developer/library]
    [Code Samples|https://www.sdn.sap.com/irj/sdn/businessobjects-samples]
    [Business Objects SDK Application Development Forums|https://www.sdn.sap.com/irj/sdn/businessobjects-sdk-forum]
    Hope this helps!
    Kind regards,
    Kristof

  • Need help with document that turned into alias for Application

    I'm trying to help my dad with a problem, not sure exactly what he did, but he had a page document in a documents folder on his desktop.  He moved it into a *files folder* on his desktop.  Somehow the document seems to have been turned into an alias for for his application folder. When I click on the file name, the document doesn't open, it opens up the Application folder.
    I'm VERY new to Mac. 
    Any help would be appreciated.  Thank you.

    This should answer the question:
    http://support.apple.com/kb/TA26514

  • Need help with pc build choice!

    Hi, Everyone,
    I have two questions actually. I want to re build my tower and i am looking at this option.
    MSI- 990FXA-GD80 AMD 9 series mother board AM3+ ATX
    CPU- FX-8120 processor- eight core
    Gpu's- Evga super clocked GeForce GTX 560 Ti 1 GB GDDR5 X2
    Ram- Corsair XMS3 8 GB DDR3 Ram 1600Mhz  (2X4GB)X2
    PSU- ThermalTake TR2 RX 850 watt ATX
    HHD- 1  Corsair 11GB SSD, 2 1 TB HDD
    Optical drives- 1- Lite -On 12x  Blue ray writer 1- DVD Rw+
    Fans-   2 x 140 LEDS mm, 3 120 mm LEDs
    15-1 all in one smart card reader
    case-  Cooler Master Scout 
    Keyboard- LogicTech G15 Gaming keyboard
    mouse- Microsoft 3000 laser
    Monitor- Gateway 23" LCD 1080p HD
    speakers- LogicTech Z506 5.1 surround sound HD
    O.S- Windows 7 service pack 2
    Ok second question is.. is 850 Watt good enough for the gpu setup and all around tower setup?
    --Current build---
    Asus- 880G M4A88TD V - EVO usb 3.0 ATX
    PSU- ThermalTake TR2 650 Watt ATX
    RAM- Corsair 8 GB 1600 Mhz ( 2X4GB)
    CPU- AMD Phenom II X4 Black edtion 955 SE 
    GPU- CrossFire X 5770s 1 GB GDDR5 Ram
    HHD- Dual 1 TB Western digtial Green drives, and one external 1 TB Western Ditgial
    Optical drives- 2x- DVD Rw+, and 1 15-1 All in one card reader
    Keyboard- G15 Gaming keyboard
    mouse-Microsoft 3000 lazer
    Monitor- Gateway HD 1080p 23" LCD
    Speakers- z506 logictech 5.1 surround sound HD
    O.S- Windows 7 Service pack 2
    Any help would be greatly helpful.
    thanks again

    Make sure the motherboard is the third revision as the earlier two had problems with the i5-2500K (Sandy Bridge)
    I prefer Asus motherboards but doesn't mean the Gigabyte is a problem. (I note that it scored 4 eggs...)
    May not make a difference in Photoshop but for Premiere the Geforce video cards with GDDR5 are preferred.
    The LiteOn iHas 224 does lightscribe which is a nice touch for clients/gifts.
    There is no room to save as I would consider your build minimum specs for a nice photoshop experience.
    As for SSD drives...my research of reviews and articles makes me feel the technology is not ready for mission critical work. So if you are running a business then I recommend not using SSD drives. Rather look at Raptor 10,000 rpm drive for Windows and Photoshop and use the Spinpoint for storage. If not business then I've read the intel x25 SSD drives are solid but I have no personal experience with them.
    Cheers,
    Steve

Maybe you are looking for