Catalyzes the NAD(P)(+)-dependent oxidation of D-glucose to D-gluconate via gluconolactone. To a lesser extent, is also active with xylose as substrate, but mannose, arabinose, galactose, fructose 6-phosphate, glucose 6-phosphate, glycerinaldehyde 3-phosphate, ribose, sorbitol, ethanol, erythritol, or lactose are not oxidized by the enzyme. Can utilize both NAD(+) and NADP(+) as electron acceptor, with a marked preference for NADP(+). Is involved in the degradation of glucose through a non-phosphorylative variant of the Entner-Doudoroff pathway