The local ring of the generic point of a prime divisor Suppose $X$ is a noetherian integral separated scheme which is regular in codimension one, i.e. every local ring $O_x$ of dimension one is regular. Let $Y$ be a prime divisor of $X$, i.e. $Y$ is a closed integral subscheme of codimension one.
The last paragraph on page 130 of Hartshorne's Algebraic Gometry states: 

If $Y$ is a prime divisor on $X$, let $\eta\in Y$ be its generic point. Then the local ring $O_{\eta,X}$ is a discrete valuation ring with quotient field $K$, the function field of $X$.



*

*How do I see that $O_{\eta,X}$ has dimension one from the fact that Y has codimension 1 in X (which means $Y$ is a maximal proper closed irreducible set)? 

*How do I see that the quotient field of $O_{\eta,X}$ is $K(X)$? This only seems true if $\eta$ were the generic point of $X$, but it is not.

 A: Let $X$ be any scheme, then I claim $\dim O_{x,X} = \operatorname{codim} \{x\}^-$ for any $x\in X$.
First step is to reduce to the case where $X$ is an affine scheme. Consider an affine open $\operatorname{Spec} A$ containing $x$, for each irreducible closed set $K$ of $X$ containing $x$, we obtain an irreducible closed set of $\operatorname{Spec} A$ containing $x$ by $K\mapsto K\cap \operatorname{Spec} A$. For each irreducible closed set of $\operatorname{Spec} A$ containing $x$, we obtain an irreducible closed set of $X$ containing $x$ by $C\mapsto C^-$, with closure taken inside $X$. We show this establishes a bijection. Clearly $C^-\cap \operatorname{Spec} A=C$, we have one sided inverse. For the other side, we need to show that $(K\cap \operatorname{Spec} A)^- = K$. Observe that $K - \operatorname{Spec} A$ and $(K\cap \operatorname{Spec} A)^-$ are two closed sets of $X$ whose union is $K$, and $(K\cap \operatorname{Spec} A)^-$ contains $x$ which is non-empty, we are thus done by irreducibility of $K$. (In fact this bijection works with same proof for any open set of $X$ containing $x$, not just $\operatorname{Spec} A$.)
Now let $P\in \operatorname{Spec} A$, we have $\dim O_{P} = \dim A_P = \operatorname{codim} P$. For each irreducible closed subset $K$ containing $P$, $K$ has a unique generic point $Q$, whence $K = \{Q\}^- = V(Q)$. Since $P\in V(Q)$ we have $P\supset Q$. Therefore an ascending chain of irreducible closed subset containing $P$ corresponds to a descending chain of prime ideals (the generic points of the irreducible closed subsets) from $P$. We thus conclude that $\dim O_P = \operatorname{codim} \{P\}^-$.
This solves question $1$ since any regular local ring of dimension $1$ is a DVR. For question two, we again reduce to an affine cover $\operatorname{Spec} A$ of $\eta$. Let $\xi$ be the generic point of $X$, we have $\xi \in \operatorname{Spec} A$ corresponds to the $0$ ideal since $A$ is a domain. Clearly the quotient ring of $A_\eta$ is $A_0 = K(O_{\xi,X}) = K(X)$.
A: As for 1. this is an algebraic theorem that a ring A is DVR iff it's Noetherian, normal, and Spec A = {0, m} where m != 0 is maximal. You can find it in Miles Reid "Undergraduate Commutative Algebra".
As for why $\mathcal{O}_{\eta,X}$ is dimension one, this is a general fact that (under Noetherian hypothesis) increasing sequences of irreducible subvarieties correspond to decreasing sequences of prime ideals, and vice versa. I cannot give any good reference, as it is covered in every textbook in "dimension" chapter.
As for 2, let $\nu$ be the generic point of $X$. Then, $\mathcal{O}_{\nu, X} = K(X)$ is localization of $\mathcal{O}_{\eta,X}$ at its maximal ideal, which is the same as quotient field.
