Example usage for org.w3c.dom NamedNodeMap getNamedItem

List of usage examples for org.w3c.dom NamedNodeMap getNamedItem

Introduction

In this page you can find the example usage for org.w3c.dom NamedNodeMap getNamedItem.

Prototype

public Node getNamedItem(String name);

Source Link

Document

Retrieves a node specified by name.

Usage

From source file:de.fhg.iais.asc.xslt.binaries.DownloadAndScale.java

private static void copyAttributes(Node source, Element target, Iterable<String> attributeNames) {
    final NamedNodeMap sourceAttributes = source.getAttributes();

    if (sourceAttributes != null) {
        for (String attrName : attributeNames) {
            final Node inputAttr = sourceAttributes.getNamedItem(attrName);

            if (inputAttr != null) {
                target.setAttribute(attrName, inputAttr.getNodeValue());
            }//from   w  ww .j ava  2s. c o m
        }
    }
}

From source file:com.connexta.arbitro.attr.AttributeSelector.java

/**
 * Creates a new <code>AttributeSelector</code> based on the DOM root of the XML type. Note that
 * as of XACML 1.1 the XPathVersion element is required in any policy that uses a selector, so
 * if the <code>xpathVersion</code> string is null, then this will throw an exception.
 * /*from   w  ww.  ja  v  a2 s. c  o  m*/
 * @param root the root of the DOM tree for the XML AttributeSelectorType XML type
 * @param metaData the meta-data associated with the containing policy
 * 
 * @return an <code>AttributeSelector</code>
 * 
 * @throws ParsingException if the AttributeSelectorType was invalid
 */
public static AttributeSelector getInstance(Node root, PolicyMetaData metaData) throws ParsingException {
    URI type = null;
    String contextPath = null;
    boolean mustBePresent = false;
    String xpathVersion = metaData.getXPathIdentifier();

    // make sure we were given an xpath version
    if (xpathVersion == null)
        throw new ParsingException("An XPathVersion is required for " + "any policies that use selectors");

    NamedNodeMap attrs = root.getAttributes();

    try {
        // there's always a DataType attribute
        type = new URI(attrs.getNamedItem("DataType").getNodeValue());
    } catch (Exception e) {
        throw new ParsingException("Error parsing required DataType " + "attribute in AttributeSelector", e);
    }

    try {
        // there's always a RequestPath
        contextPath = attrs.getNamedItem("RequestContextPath").getNodeValue();
    } catch (Exception e) {
        throw new ParsingException(
                "Error parsing required " + "RequestContextPath attribute in " + "AttributeSelector", e);
    }

    try {
        // there may optionally be a MustBePresent
        Node node = attrs.getNamedItem("MustBePresent");
        if (node != null)
            if (node.getNodeValue().equals("true"))
                mustBePresent = true;
    } catch (Exception e) {
        // this shouldn't happen, since we check the cases, but still...
        throw new ParsingException("Error parsing optional attributes " + "in AttributeSelector", e);
    }

    // as of 1.2 we need the root element of the policy so we can get
    // the namespace mapping, but in order to leave the APIs unchanged,
    // we'll walk up the tree to find the root rather than pass this
    // element around through all the code
    Node policyRoot = null;
    Node node = root.getParentNode();

    while ((node != null) && (node.getNodeType() == Node.ELEMENT_NODE)) {
        policyRoot = node;
        node = node.getParentNode();
    }

    // create the new selector
    return new AttributeSelector(type, contextPath, policyRoot, mustBePresent, xpathVersion);
}

From source file:com.redhat.rhevm.api.powershell.util.PowerShellParser.java

private static String getAttr(NamedNodeMap attrs, String name) {
    Node type = attrs.getNamedItem(name);
    if (type != null) {
        return type.getNodeValue();
    } else {/*  ww  w  .  j  a  va2 s  . co m*/
        return null;
    }
}

From source file:it.polimi.diceH2020.plugin.control.JSonReader.java

/**
 * set the attribute named as "name" in the node "n" with a given value
 * /*from   w ww  .j a v  a 2s. c  o m*/
 * @param n
 *            the node in which you want to set the attribute
 * @param name
 *            the name of the attribute
 * @param value
 *            the value of the attribute
 */
private static void setAttribute(Node n, String name, String value) {
    NamedNodeMap attributes = n.getAttributes();
    if (!JSonReader.findAttribute(attributes, name)) {
        Element el = (Element) n;
        el.setAttribute(name, value);
    } else {
        Node nodeAttrType1 = attributes.getNamedItem(name);
        nodeAttrType1.setTextContent(value);
    }
}

From source file:de.akra.idocit.wsdl.services.DocumentationParser.java

/**
 * Returns the name of the thematic grid in the given documentation-element.
 * //from   w  w w. ja v a  2s .  c  o m
 * Please note: This method returns the name of the first thematic grid found in the
 * list of documentation's children.
 * 
 * @param docElemWithThematicGrid
 *            The &lt;documentation&gt;-element containing the thematic grid.
 * 
 * @return The name of the first found thematic grid
 */
public static String readThematicGridName(Element docElemWithThematicGrid) {
    NodeList documentationChildren = docElemWithThematicGrid.getChildNodes();

    int children = documentationChildren.getLength();

    for (int i = 0; i < children; i++) {
        Node child = documentationChildren.item(i);

        if (child.getNodeName().equals(THEMATIC_GRID_TAG_NAME)) {
            NamedNodeMap attributes = child.getAttributes();

            if (attributes != null) {
                Node nameAttribute = attributes.getNamedItem(THEMATIC_GRID_ATTRIBUTE_NAME);

                if (nameAttribute != null) {
                    return nameAttribute.getNodeValue();
                } else {
                    // It seems that we have an incomplete
                    // <thematicgrid>-element. This is why we don't continue
                    // to search for a named one.
                    return null;
                }
            } else {
                // It seems that we have an incomplete
                // <thematicgrid>-element. This is why we don't continue to
                // search for a named one.
                return null;
            }
        }
    }

    return null;
}

From source file:com.runwaysdk.browser.JavascriptTestRunner.java

public static Test suite() throws Exception {
    // Read project.version
    Properties prop1 = new Properties();
    ClassLoader loader1 = Thread.currentThread().getContextClassLoader();
    InputStream stream1 = loader1.getResourceAsStream("avail-maven.properties");
    prop1.load(stream1);// w  ww. j  a  v  a  2  s . co m
    String projVer = prop1.getProperty("mvn.project.version");

    TestSuite suite = new TestSuite();

    int browserLoopIterationNumber = 0;

    System.out.println("Preparing to run cross-browser javascript unit tests.");
    long totalTime = System.currentTimeMillis();

    for (String browser : supportedBrowsers) {
        try {
            String browserDisplayName = String.valueOf(browser.charAt(1)).toUpperCase() + browser.substring(2);
            System.out.println("Opening " + browserDisplayName);

            TestSuite browserSuite = new TestSuite(browserDisplayName);

            selenium = new DefaultSelenium("localhost", 4444, browser,
                    "http://localhost:8080/runwaysdk-browser-test-" + projVer + "/");
            selenium.start();
            isSeleniumStarted = true;
            selenium.open("MasterTestLauncher.jsp");

            //          selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementById('all');", "6000");

            selenium.setTimeout("1000");

            System.out.println("Running tests...");
            long time = System.currentTimeMillis();

            selenium.click("all");
            selenium.waitForCondition(
                    "!selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Runner.isRunning()",
                    Integer.toString(MAXIMUM_TOTAL_TEST_DURATION * 1000));

            time = System.currentTimeMillis() - time; // elapsed time in milis
            if (time < 1000) {
                System.out.println("Tests completed in " + time + " miliseconds.");
            } else if (time < 60000) {
                time = time / 1000;
                System.out.println("Tests completed in " + time + " seconds.");
            } else if (time < 3600000) {
                time = time / (1000 * 60);
                System.out.println("Tests completed in " + time + " minutes.");
            } else {
                time = time / (1000 * 60 * 60);
                System.out.println("Tests completed in " + time + " hours.");
            }

            //System.out.println(selenium.getEval("\n\n" + "selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Runner.getResults(selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Format.XML);") + "\n\n");

            // tests are done running, get the results and display them through junit

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();

            String resultsJunitXML = selenium.getEval(
                    "selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Runner.getResults(selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Format.JUnitXML);");
            String resultsYUITestXML = selenium.getEval(
                    "selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Runner.getResults(selenium.browserbot.getCurrentWindow().com.runwaysdk.test.TestFramework.getY().Test.Format.XML);");

            // Write the test output to xml
            Properties prop = new Properties();
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            InputStream stream = loader.getResourceAsStream("default/common/terraframe.properties");
            prop.load(stream);
            String basedir = prop.getProperty("local.root");

            System.out.println("Writing javascript test results to '" + basedir
                    + "/target/surefire-reports/TEST-com.runwaysdk.browser.JavascriptTestRunner-"
                    + browserDisplayName + ".xml.");
            File dir = new File(basedir + "/target/surefire-reports");
            dir.mkdirs();
            final OutputStream os = new FileOutputStream(dir.getAbsolutePath()
                    + "/TEST-com.runwaysdk.browser.JavascriptTestRunner-" + browserDisplayName + ".xml", false);
            final PrintStream printStream = new PrintStream(os);
            printStream.print(resultsJunitXML);
            printStream.close();

            InputSource in = new InputSource();
            in.setCharacterStream(new StringReader(resultsYUITestXML));
            Element doc = db.parse(in).getDocumentElement();

            NodeList suiteList = doc.getElementsByTagName("testsuite");

            if (suiteList == null || suiteList.getLength() == 0) {
                //suiteList = (NodeList)doc;
                throw new Exception("Unable to find any suites!");
            }

            String uniqueWhitespace = "";
            for (int j = 0; j < browserLoopIterationNumber; j++) {
                uniqueWhitespace = uniqueWhitespace + " ";
            }

            for (int i = 0; i < suiteList.getLength(); i++) //looping through test suites
            {
                Node n = suiteList.item(i);
                TestSuite s = new TestSuite();
                NamedNodeMap nAttrMap = n.getAttributes();

                s.setName(nAttrMap.getNamedItem("name").getNodeValue() + uniqueWhitespace);

                NodeList testCaseList = ((Element) n).getElementsByTagName("testcase");
                for (int j = 0; j < testCaseList.getLength(); j++) // looping through test cases
                {
                    Node x = testCaseList.item(j);
                    NamedNodeMap xAttrMap = x.getAttributes();

                    TestSuite testCaseSuite = new TestSuite();
                    testCaseSuite.setName(xAttrMap.getNamedItem("name").getNodeValue() + uniqueWhitespace);

                    NodeList testList = ((Element) x).getElementsByTagName("test");
                    for (int k = 0; k < testList.getLength(); k++) // looping through tests
                    {
                        Node testNode = testList.item(k);
                        NamedNodeMap testAttrMap = testNode.getAttributes();

                        Test t = new GeneratedTest(
                                testAttrMap.getNamedItem("name").getNodeValue() + uniqueWhitespace);

                        if (testAttrMap.getNamedItem("result").getNodeValue().equals("fail")) {
                            ((GeneratedTest) t).testFailMessage = testAttrMap.getNamedItem("message")
                                    .getNodeValue();
                        }

                        testCaseSuite.addTest(t);
                    }

                    s.addTest(testCaseSuite);
                }

                browserSuite.addTest(s);
            }

            //suite.addTest(browserSuite);
            browserLoopIterationNumber++;
        } // end try
        catch (Exception e) {
            throw (e);
        } finally {
            if (isSeleniumStarted) {
                selenium.stop();
                isSeleniumStarted = false;
            }
        }
    } // end for loop on browsers

    totalTime = System.currentTimeMillis() - totalTime; // elapsed time in milis
    if (totalTime < 1000) {
        System.out.println("Cross-browser javascript unit tests completed in " + totalTime + " miliseconds.");
    } else if (totalTime < 60000) {
        totalTime = totalTime / 1000;
        System.out.println("Cross-browser javascript unit tests completed in " + totalTime + " seconds.");
    } else if (totalTime < 3600000) {
        totalTime = totalTime / (1000 * 60);
        System.out.println("Cross-browser javascript unit tests completed in " + totalTime + " minutes.");
    } else {
        totalTime = totalTime / (1000 * 60 * 60);
        System.out.println("Cross-browser javascript unit tests completed in " + totalTime + " hours.");
    }

    return suite;
}

From source file:com.github.sevntu.checkstyle.internal.ChecksTest.java

private static void validateSonarProperties(Class<?> module, Set<Node> parameters) {
    final String moduleName = module.getName();
    final Set<String> properties = getFinalProperties(module);

    for (Node parameter : parameters) {
        final NamedNodeMap attributes = parameter.getAttributes();
        final Node paramKeyNode = attributes.getNamedItem("key");

        Assert.assertNotNull(moduleName + " requires a key for unknown parameter in sonar", paramKeyNode);

        final String paramKey = paramKeyNode.getTextContent();

        Assert.assertFalse(moduleName + " requires a valid key for unknown parameter in sonar",
                paramKey.isEmpty());/*from  w ww .  j  a v a2  s .c  o m*/

        Assert.assertTrue(moduleName + " has an unknown parameter in sonar: " + paramKey,
                properties.remove(paramKey));
    }

    for (String property : properties) {
        Assert.fail(moduleName + " parameter not found in sonar: " + property);
    }
}

From source file:edu.stanford.muse.webapp.Accounts.java

/** does account setup and login (and look up default folder if well-known account) from the given request.
 * request params are loginName<N>, password<N>, etc (see loginForm for details).
 * returns an object with {status: 0} if success, or {status: <non-zero>, errorMessage: '... '} if failure.
 * if success and account has a well-known sent mail folder, the returned object also has something like: 
 * {defaultFolder: '[Gmail]/Sent Mail', defaultFolderCount: 1033}
 * accounts on the login page are numbered 0 upwards. */
public static JSONObject login(HttpServletRequest request, int accountNum) throws IOException, JSONException {
    JSONObject result = new JSONObject();

    HttpSession session = request.getSession();
    // allocate the fetcher if it doesn't already exist
    MuseEmailFetcher m = null;/*from  w ww.j  av a2 s.  c om*/
    synchronized (session) // synchronize, otherwise may lose the fetcher when multiple accounts are specified and are logged in to simult.
    {
        m = (MuseEmailFetcher) JSPHelper.getSessionAttribute(session, "museEmailFetcher");
        boolean doIncremental = request.getParameter("incremental") != null;

        if (m == null || !doIncremental) {
            m = new MuseEmailFetcher();
            session.setAttribute("museEmailFetcher", m);
        }
    }

    // note: the same params get posted with every accountNum
    // we'll update for all account nums, because sometimes account #0 may not be used, only #1 onwards. This should be harmless.
    // we used to do only altemailaddrs, but now also include the name.
    updateUserInfo(request);

    String accountType = request.getParameter("accountType" + accountNum);
    if (Util.nullOrEmpty(accountType)) {
        result.put("status", 1);
        result.put("errorMessage", "No information for account #" + accountNum);
        return result;
    }

    String loginName = request.getParameter("loginName" + accountNum);
    String password = request.getParameter("password" + accountNum);
    String protocol = request.getParameter("protocol" + accountNum);
    //   String port = request.getParameter("protocol" + accountNum);  // we don't support pop/imap on custom ports currently. can support server.com:port syntax some day
    String server = request.getParameter("server" + accountNum);
    String defaultFolder = request.getParameter("defaultFolder" + accountNum);

    if (server != null)
        server = server.trim();

    if (loginName != null)
        loginName = loginName.trim();

    // for these ESPs, the user may have typed in the whole address or just his/her login name
    if (accountType.equals("gmail") && loginName.indexOf("@") < 0)
        loginName = loginName + "@gmail.com";
    if (accountType.equals("yahoo") && loginName.indexOf("@") < 0)
        loginName = loginName + "@yahoo.com";
    if (accountType.equals("live") && loginName.indexOf("@") < 0)
        loginName = loginName + "@live.com";
    if (accountType.equals("stanford") && loginName.indexOf("@") < 0)
        loginName = loginName + "@stanford.edu";
    if (accountType.equals("gmail"))
        server = "imap.gmail.com";

    // add imapdb stuff here.
    boolean imapDBLookupFailed = false;
    String errorMessage = "";
    int errorStatus = 0;

    if (accountType.equals("email") && Util.nullOrEmpty(server)) {
        log.info("accountType = email");

        defaultFolder = "Sent";

        {
            // ISPDB from Mozilla
            imapDBLookupFailed = true;

            String emailDomain = loginName.substring(loginName.indexOf("@") + 1);
            log.info("Domain: " + emailDomain);

            // from http://suhothayan.blogspot.in/2012/05/how-to-install-java-cryptography.html
            // to get around the need for installingthe unlimited strength encryption policy files.
            try {
                Field field = Class.forName("javax.crypto.JceSecurity").getDeclaredField("isRestricted");
                field.setAccessible(true);
                field.set(null, java.lang.Boolean.FALSE);
            } catch (Exception ex) {
                ex.printStackTrace();
            }

            //            URL url = new URL("https://live.mozillamessaging.com/autoconfig/v1.1/" + emailDomain);
            URL url = new URL("https://autoconfig.thunderbird.net/v1.1/" + emailDomain);
            try {
                URLConnection urlConnection = url.openConnection();
                InputStream in = new BufferedInputStream(urlConnection.getInputStream());

                DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
                Document doc = dBuilder.parse(in);

                NodeList configList = doc.getElementsByTagName("incomingServer");
                log.info("configList.getLength(): " + configList.getLength());

                int i;
                for (i = 0; i < configList.getLength(); i++) {
                    Node config = configList.item(i);
                    NamedNodeMap attributes = config.getAttributes();
                    if (attributes.getNamedItem("type").getNodeValue().equals("imap")) {
                        log.info("[" + i + "] type: " + attributes.getNamedItem("type").getNodeValue());
                        Node param = config.getFirstChild();
                        String nodeName, nodeValue;
                        String paramHostName = "";
                        String paramUserName = "";
                        do {
                            if (param.getNodeType() == Node.ELEMENT_NODE) {
                                nodeName = param.getNodeName();
                                nodeValue = param.getTextContent();
                                log.info(nodeName + "=" + nodeValue);
                                if (nodeName.equals("hostname")) {
                                    paramHostName = nodeValue;
                                } else if (nodeName.equals("username")) {
                                    paramUserName = nodeValue;
                                }
                            }
                            param = param.getNextSibling();
                        } while (param != null);

                        log.info("paramHostName = " + paramHostName);
                        log.info("paramUserName = " + paramUserName);

                        server = paramHostName;
                        imapDBLookupFailed = false;
                        if (paramUserName.equals("%EMAILADDRESS%")) {
                            // Nothing to do with loginName
                        } else if (paramUserName.equals("%EMAILLOCALPART%")
                                || paramUserName.equals("%USERNAME%")) {
                            // Cut only local part
                            loginName = loginName.substring(0, loginName.indexOf('@') - 1);
                        } else {
                            imapDBLookupFailed = true;
                            errorMessage = "Invalid auto configuration";
                        }

                        break; // break after find first IMAP host name
                    }
                }
            } catch (Exception e) {
                Util.print_exception("Exception trying to read ISPDB", e, log);
                errorStatus = 2; // status code = 2 => ispdb lookup failed
                errorMessage = "No automatic configuration available for " + emailDomain
                        + ", please use the option to provide a private (IMAP) server. \nDetails: "
                        + e.getMessage()
                        + ". \nRunning with java -Djavax.net.debug=all may provide more details.";
            }
        }
    }

    if (imapDBLookupFailed) {
        log.info("ISPDB Fail");
        result.put("status", errorStatus);
        result.put("errorMessage", errorMessage);
        // add other fields here if needed such as server name attempted to be looked up in case the front end wants to give a message to the user
        return result;
    }

    boolean isServerAccount = accountType.equals("gmail") || accountType.equals("email")
            || accountType.equals("yahoo") || accountType.equals("live") || accountType.equals("stanford")
            || accountType.equals("gapps") || accountType.equals("imap") || accountType.equals("pop")
            || accountType.startsWith("Thunderbird");

    if (isServerAccount) {
        boolean sentOnly = "on".equals(request.getParameter("sent-messages-only"));
        return m.addServerAccount(server, protocol, defaultFolder, loginName, password, sentOnly);
    } else if (accountType.equals("mbox") || accountType.equals("tbirdLocalFolders")) {
        try {
            String mboxDir = request.getParameter("mboxDir" + accountNum);
            String emailSource = request.getParameter("emailSource" + accountNum);
            // for non-std local folders dir, tbird prefs.js has a line like: user_pref("mail.server.server1.directory-rel", "[ProfD]../../../../../../tmp/tb");
            log.info("adding mbox account: " + mboxDir);
            errorMessage = m.addMboxAccount(emailSource, mboxDir, accountType.equals("tbirdLocalFolders"));
            if (!Util.nullOrEmpty(errorMessage)) {
                result.put("errorMessage", errorMessage);
                result.put("status", 1);
            } else
                result.put("status", 0);
        } catch (MboxFolderNotReadableException e) {
            result.put("errorMessage", e.getMessage());
            result.put("status", 1);
        }
    } else {
        result.put("errorMessage", "Sorry, unknown account type: " + accountType);
        result.put("status", 1);
    }
    return result;
}

From source file:com.github.sevntu.checkstyle.internal.ChecksTest.java

private static void validateEclipseCsMetaXmlFileRules(String pkg, Set<Class<?>> pkgModules, Set<Node> rules)
        throws Exception {
    for (Node rule : rules) {
        final NamedNodeMap attributes = rule.getAttributes();
        final Node internalNameNode = attributes.getNamedItem("internal-name");

        Assert.assertNotNull(pkg + " checkstyle-metadata.xml must contain an internal name", internalNameNode);

        final String internalName = internalNameNode.getTextContent();
        final String classpath = "com.github.sevntu.checkstyle.checks." + pkg + "." + internalName;

        final Class<?> module = findModule(pkgModules, classpath);
        pkgModules.remove(module);/*from   ww w.java2s . co  m*/

        Assert.assertNotNull("Unknown class found in " + pkg + " checkstyle-metadata.xml: " + internalName,
                module);

        final Node nameAttribute = attributes.getNamedItem("name");

        Assert.assertNotNull(pkg + " checkstyle-metadata.xml requires a name for " + internalName,
                nameAttribute);
        Assert.assertEquals(pkg + " checkstyle-metadata.xml requires a valid name for " + internalName,
                "%" + internalName + ".name", nameAttribute.getTextContent());

        final Node parentAttribute = attributes.getNamedItem("parent");

        Assert.assertNotNull(pkg + " checkstyle-metadata.xml requires a parent for " + internalName,
                parentAttribute);
        Assert.assertEquals(pkg + " checkstyle-metadata.xml requires a valid parent for " + internalName,
                "TreeWalker", parentAttribute.getTextContent());

        final Set<Node> children = XmlUtil.getChildrenElements(rule);

        validateEclipseCsMetaXmlFileRule(pkg, module, children);
    }
}

From source file:com.ryderbot.utils.ModelUtils.java

public static MarketOrder generateMarketOrder(NamedNodeMap attributes) {
    DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    Long orderID = Long.parseLong(attributes.getNamedItem("orderID").getNodeValue());
    Long charID = Long.parseLong(attributes.getNamedItem("charID").getNodeValue());
    Long stationID = Long.parseLong(attributes.getNamedItem("stationID").getNodeValue());
    Integer volEntered = Integer.parseInt(attributes.getNamedItem("volEntered").getNodeValue());
    Integer volRemaining = Integer.parseInt(attributes.getNamedItem("volRemaining").getNodeValue());
    Integer minVolume = Integer.parseInt(attributes.getNamedItem("minVolume").getNodeValue());
    Integer orderState = Integer.parseInt(attributes.getNamedItem("orderState").getNodeValue());
    Long typeID = Long.parseLong(attributes.getNamedItem("typeID").getNodeValue());
    Integer range = Integer.parseInt(attributes.getNamedItem("range").getNodeValue());
    Long accountKey = Long.parseLong(attributes.getNamedItem("accountKey").getNodeValue());
    Integer duration = Integer.parseInt(attributes.getNamedItem("duration").getNodeValue());
    Double escrow = Double.parseDouble(attributes.getNamedItem("escrow").getNodeValue());
    Double price = Double.parseDouble(attributes.getNamedItem("price").getNodeValue());
    Double bid = Double.parseDouble(attributes.getNamedItem("bid").getNodeValue());

    Date issued = null;/*w  w  w  .  j av a 2 s  .co  m*/

    try {
        issued = dateFormatter.parse(attributes.getNamedItem("issued").getNodeValue());
    } catch (DOMException | ParseException e) {

    }

    MarketOrder order = new MarketOrder(orderID);
    order.setCharID(charID);
    order.setStationID(stationID);
    order.setVolEntered(volEntered);
    order.setVolRemaining(volRemaining);
    order.setMinVolume(minVolume);
    order.setOrderState(orderState);
    order.setTypeID(typeID);
    order.setRange(range);
    order.setAccountKey(accountKey);
    order.setDuration(duration);
    order.setEscrow(escrow);
    order.setPrice(price);
    order.setBid(bid);
    order.setIssued(issued);

    return order;
}