I am trying to read below XML in Java, but due to not symmetrical element in XML, not able to read - and also, How can I check if the node is available or not  This is the XML-  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Root&gt;    &lt;node-path path="USA"&gt;       &lt;property-name&gt;Name&lt;/property-name&gt;       &lt;property-value&gt;&lt;![CDATA[Cat A]]&gt;&lt;/property-value&gt;        &lt;/node-path&gt;    &lt;node-path path="Canada"&gt;       &lt;property-name&gt;Name&lt;/property-name&gt;       &lt;property-value /&gt;    &lt;/node-path&gt;    &lt;node-path path="Australia"&gt;       &lt;property-name&gt;Name&lt;/property-name&gt;       &lt;json-counter&gt;1&lt;/json-counter&gt;       &lt;json-property&gt;&lt;![CDATA[Cat A]]&gt;&lt;/json-property&gt;       &lt;json-property&gt;&lt;![CDATA[Cat B]]&gt;&lt;/json-property&gt;       &lt;json-property&gt;&lt;![CDATA[Cat C]]&gt;&lt;/json-property&gt;       &lt;json-counter&gt;2&lt;/json-counter&gt;       &lt;json-property&gt;&lt;![CDATA[Cat D]]&gt;&lt;/json-property&gt;       &lt;json-property&gt;&lt;![CDATA[Cat E]]&gt;&lt;/json-property&gt;       &lt;json-property&gt;&lt;![CDATA[Cat F]]&gt;&lt;/json-property&gt;       &lt;property-value /&gt;    &lt;/node-path&gt;    &lt;node-path path="UK"&gt;       &lt;property-name&gt;Name&lt;/property-name&gt;       &lt;property-value&gt;&lt;![CDATA[0]]&gt;&lt;/property-value&gt;    &lt;/node-path&gt; &lt;/Root&gt;`   And this is the code I am trying-   try {          File inputFile = new File("c://test.xml");      DocumentBuilderFactory dbFactory =DocumentBuilderFactory.newInstance();      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();      Document doc = dBuilder.parse(inputFile);      doc.getDocumentElement().normalize();      NodeList nListNodePath = doc.getElementsByTagName("node-path");       for (int i = 0; i &lt; nListNodePath.getLength(); i++) {         Node nNodePath = nListNodePath.item(i);         if (nNodePath.getNodeType() == Node.ELEMENT_NODE) {             Element eElement1 = (Element) nNodePath;             System.out.println("Node Path--- : "+ eElement1.getAttribute("path"));             System.out.println("Property Name : " + eElement1.getElementsByTagName("property-name").item(0).getTextContent());             System.out.println("Property value : " + eElement1.getElementsByTagName("property-value").item(0).getTextContent());             System.out.println("Json Counter : " + eElement1.getElementsByTagName("json-counter").item(0).getTextContent());             System.out.println("JSON property : " + eElement1.getElementsByTagName("json-property").item(0).getTextContent());         }     }
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Is there any way to keep a command from being added to your history? I have a command that I want to keep out of my history file, and I really don't care to have it there when I search the history stored in memory, though that's less of a concern. Is there any way to prevent this, or do I just have to go back and edit my history file.  update: I didn't realize this might be shell-specific. My shell is zsh. You're welcome to answer for other shells so people know how to do this in their shell. Book about a teenager programmed to be an assassin and trying to get back at the people responsible I read this book a few years back (around 5?). It was part of a multibook series but I have only read one book.  It's about this teenager who I think had been programmed to be an assassin but then somehow retained his conscience and was out to get the people responsible for that.  I briefly remember a girl, and this one part where he realizes he can ride a horse and then there's a chase too. I think the guy's name was Jim or Jimmy, but not quite. I'm also quite sure he was either part computer, or had a chip or something in his brain which had been programmed to give him a host of mental and physical abilities which he retained and used as well as the series progressed. How exactly does curved space-time describe the force of gravity? I understand that people explain (in layman's terms at least) that the presence of mass "warps" space-time geometry, and this causes gravity. I have also of course heard the analogy of a blanket or trampoline bending under an object, which causes other objects to come together, but I always thought this was a hopelessly circular explanation because the blanket only bends because of "real" gravity pulling the object down and then pulling the other objects down the sloped blanket. In other words, to me, it seems that curved space wouldn't have any actual effect on objects unless there's already another force present.   So how is curved space-time itself actually capable of exerting a force (without some source of a fourth-dimensional force)?  I apologize for my ignorance in advance, and a purely mathematical explanation will probably go over my head, but if it's required I'll do my best to understand. Content type permission to specific users How do I set content permission so that specific content types become visible/usable to the admin user only, while other content types may be visible by other user roles?  After I added new content types, I checked the rebuild permissions.   Content access is working fine but the problem seems to be the fact that the enw content types aren't made visible / accessible to the other roles... Summing data from column in the Attribute table I'm working with population data, and I have an issue when it comes to knowing the sum of a population inside the attribute table.  In my attribute table, I'd like to add all the numbers in the red box, i.e. all the numbers together from the column &quot;UN_2015_E&quot;. Is there a way to do so? Don't you think people need to know what they did wrong exactly so they can fix it and get unbanned from asking questions or posting answers? Differentiating $y=x^{2}$ I am reading in a book about differentiating, but I am confused with one of the steps he takes.  We start with:  $$ \begin{align} y &amp;= x^{2} \\ y + \mathrm{d}y &amp;= (x + \mathrm{d}x)^2 \\ y + \mathrm{d}y &amp;= x^2 + x\mathrm{d}x + x\mathrm{d}x + (\mathrm{d}x^2) \end{align} $$  Now the author simplifies this to:  $$y + dy = x^2 + 2x\mathrm{d}x + (\mathrm{d}x^2)$$  I dislike how the middle term is simplified to $2x\mathrm{d}x$ instead of $2(x\mathrm{d}x)$, as I feel like it is more intuitive on what is going.  As in, $2$ of the term $x\mathrm{d}x$, instead of $2x\mathrm{d}x$.  But I fear writing it as $2(x\mathrm{d}x)$ may result in an incorrect distributive property.  Next, he omits the $(dx^2)$:  $$y + \mathrm{d}y = x^2 + 2x \mathrm{d}x$$  Subtract the original $y = x^2$:  $$\mathrm{d}y = 2x \mathrm{d}x$$  Now here is where I get confused:  $$\frac{\mathrm{d}y}{\mathrm{d}x} = 2x$$  How can he just divide both sides by $\mathrm{d}x$!?  If the original term was $2$ of $x\mathrm{d}x$, wouldn't it have to be written out as $2x * 2\mathrm{d}x$, and thus divide both sides by $2\mathrm{d}x$ instead?  I think the root of my confusion is how to properly simplify: $$x\mathrm{d}x + x\mathrm{d}x$$  I trust that he is right, but I am looking for an explanation of why his simplification can work, and why $2(x\mathrm{d}x)$ would be incorrect!  Thank you! An example of a group such that $G \cong G \times G$ I was trying to find an example such that $G \cong G \times G$, but I am not getting anywhere. Obviously no finite group satisfies it. What is such group? Quick question about curly braces not showing up Ii am writing a short code, so I doubt anything else in the code is causing the problem. This is the problematic line of code:  \[ M_R := \max {|f(z)|: |z - z_0| = R }\le M\]   It doesn't show the curly braces. I've tried using \left{ and \right} but to no avail.  What should I do?  Thank you Why is a person's location exclusively tied to their communicator? In Star Trek it is frequently seen that when a crew member wants to avoid being tracked, they'll leave their communicator somewhere (quarters, corridor etc) which throws the computer and ship's security off their trail.  However, the entire interior of the ship is under constant surveillance by the internal sensors. Barring damage to the ship or sensors, or some space phenomenon causing radiation X to create interference, why aren't these internal sensors able to continue tracking every person on board regardless of where their comm-badge is? In the worst case, they should be able deduce who the errant individual is by simple subtraction: "I can see where all the other comm-badges are, so subtract them and the remaining life form must be the person I am looking for." But this never seems to be done either.  Is Star Fleet security really so inept or is there some other limitation in play that is never mentioned? $\mathbb{F}_p[X]/(X^2+X+1)$ is a field iff $p \equiv 2 \bmod 3$ Every time I try to create a table using MySQL Workbench 6.3 CE it adds "broken" comments at the end of the script.  Example:  I am trying to create a table called "user". This is what the table should look like:   However when I click the apply button, the script generates incorrectly:  CREATE TABLE `user` (   `userid` INT NOT NULL AUTO_INCREMENT COMMENT '',   `record_status` INT NOT NULL DEFAULT 1 COMMENT '',   `createdby` VARCHAR(75) NOT NULL COMMENT '',   `createddate` DATETIME NOT NULL COMMENT '',   `updatedby` VARCHAR(75) NULL COMMENT '',   `updateddate` DATETIME NULL COMMENT '',   `username` INT NOT NULL COMMENT '',   `password` VARCHAR(75) NULL COMMENT '',   `firstname` VARCHAR(75) NULL COMMENT '',   `lastname` VARCHAR(75) NULL COMMENT '',   `email` VARCHAR(75) NULL COMMENT '',   `facebook_userid` VARCHAR(75) NULL COMMENT '',   `email_verified` VARCHAR(75) NULL COMMENT '',   PRIMARY KEY (`userid`, `username`)  COMMENT '');   The comment in this line should not be there, so the code should be:   PRIMARY KEY (`userid`, `username`));   and the code executes when I paste it into an editor and remove this comment. However I create massive databases daily. (Each with +- 15 tables). I can't keep doing this for each table as it is time consuming.  How can I disable this feature that adds the comments to the script? I don't need them in my databases When thinking about travelling, I often have to think about a place to visit, and then look up visa rules for that particular country. This can be a fairly painful process because official government sites can often be hard to find, and advice on (say) guidebooks or Wikitravel tends to be generic.  Is there any resource where I can enter my nationality/residency, and then look up a list of visa rules for various countries? Block error on CMI I have two identical sites on Drupal 8 (A and B), on (A) I created a custom block(block/add), and then I export the configuration(drush config-export) and import this config on (B) (drush config-import), no error, but on the site (B) the block that I imported said on any region that I put "This block is broken or missing. You may be missing content or you might need to enable the original module." And I cant edit the content of this block. How I can fix that?  Site A:    Site B: Idempotent linear operators are projections What's the difference between:        Have someone do something     Make someone do something   Get someone do something.      To have someone do something means to cause someone to do something. To make someone do something means to force someone to do something. To get someone do something means to persuade someone or trick someone to do something.  This is what the dictionary says but I saw they're sometimes interchangeably used, so dictionary definitions are not enough. Android app intermittently shows blank body in questions and answers (multiple sites) How do I use tab stops in enumerate or itemize? Current code is:  \begin{enumerate}[label=LEVEL \arabic{*},leftmargin=*]     \item Description of Level 1 \quad L1 \\ \emph{more text}     \item Description of Level 2 \quad L2 \\ \emph{more text}  \end{enumerate}   but the \quad does not align L1 and L2 uniformly vertically. I want to replace \quad with a tab but the tabbing environment does not allow mixing with an enumerate! Which command should I use for displayed equations? A number of related questions have already been asked about this issue:       and even    But I'm still confused by the conflicting suggestions that have been given so far. So I'm trying again.  Which should be the preferred command to produce a displayed equation in my LaTeX documents?  So far the suggestions indicate that one should use \[ ... \], maybe \begin{equation*} ... \end{equation*}, or maybe even the gather* or align* environments from amsmath.  And one should definitely avoid using either $$...$$ or the eqnarray environment.  Now I have to say that, from a language perspective, I have a strong preference for the equation* environment because it is less cryptic than the \[ ... \] notation and it is  the most accurate.  So, is it fine to use equation*? Maybe only after loading amsmath? Or should the equation/equation* environment be redefined to something else so that spacing, package support, or whatever is improved? Two electrons, or an electron and a proton, interact with each other because of the Coulomb potential, which can also be seen in the Schrödinger equation (which is the equation that describes the motion for elementary particles).  But how do an electron and a photon interact? Why can a photon kick up an electron to a higher atomic orbital, or why is a photon emitted when an electron jumps down to a lower orbital? A photon do not have any charge, so the interaction cannot be caused by the Coulomb potential. So what is it that causes the interaction, and how does that affect the Schrödinger equation? (Or well, the relativistic version of the Schrödinger equation, since we're dealing with photons.)