internal static Node CreateNode(XmlValue v) { if (v == null) { return(null); } if (v.getType() != XmlValue.NODE) { throw new Exception("XmlValue is not of type XmlValue.NODE"); } if (v.getNodeType() == XmlValue.DOCUMENT_NODE) { Document document = Document.Create(v.asDocument()); v.Dispose(); return(document); } return(new NodeImpl(v)); }