VTD Doc help - select nested data

I am reading through data and parsing out a list of invoices. below is an example of one invoice

				<e>
					<adminFeeFlatBill>
						<e><![CDATA[6.61]]></e>
						<e><![CDATA[8.02]]></e>
						<e><![CDATA[19.37]]></e>
					</adminFeeFlatBill>
					<adminFeeFlatDscnt/>
					<adminFeeHoursBill/>
					<adminFeeHoursDscnt/>
					<adminFeeMinMax/>
					<adminFeeWageBill/>
					<adminFeeWageDscnt/>
					<adminWcFeeDscnt/>
					<batchNumber><![CDATA[201931]]></batchNumber>
					<billTaxes>
						<e>
							<comBillAmt><![CDATA[89.28]]></comBillAmt>
							<comTaxType><![CDATA[8F]]></comTaxType>
						</e>
						<e>
							<comBillAmt><![CDATA[20.88]]></comBillAmt>
							<comTaxType><![CDATA[9F]]></comTaxType>
						</e>
						<e>
							<comBillAmt><![CDATA[0.0]]></comBillAmt>
							<comTaxType><![CDATA[4F]]></comTaxType>
						</e>
						<e>
							<comBillAmt><![CDATA[0.0]]></comBillAmt>
							<comTaxType><![CDATA[4S]]></comTaxType>
						</e>
					</billTaxes>
					<billingDetails/>
					<compensation><![CDATA[9015]]></compensation>
					<department/>
					<division/>
					<employeeId><![CDATA[A04753]]></employeeId>
					<invoice><![CDATA[012154]]></invoice>
					<location><![CDATA[1]]></location>
					<payDate><![CDATA[2019-08-30]]></payDate>
					<position><![CDATA[MAITEC]]></position>
					<project/>
					<shift/>
					<sumBilling>
						<e>
							<billAmt><![CDATA[1440.0]]></billAmt>
							<billCode><![CDATA[000]]></billCode>
							<billCodeDescription><![CDATA[GROSS WAGES]]></billCodeDescription>
						</e>
						<e>
							<billAmt><![CDATA[89.28]]></billAmt>
							<billCode><![CDATA[001]]></billCode>
							<billCodeDescription><![CDATA[FICA-OASDI]]></billCodeDescription>
						</e>
						<e>
							<billAmt><![CDATA[20.88]]></billAmt>
							<billCode><![CDATA[002]]></billCode>
							<billCodeDescription><![CDATA[FICA-MEDICARE]]></billCodeDescription>
						</e>
						<e>
							<billAmt><![CDATA[62.93]]></billAmt>
							<billCode><![CDATA[005]]></billCode>
							<billCodeDescription><![CDATA[WORKERS COMPENSATION]]></billCodeDescription>
						</e>
						<e>
							<billAmt><![CDATA[34.0]]></billAmt>
							<billCode><![CDATA[006]]></billCode>
							<billCodeDescription><![CDATA[ADMINISTRATIVE FEE]]></billCodeDescription>
						</e>
					</sumBilling>
					<voucherId><![CDATA[001474]]></voucherId>
					<voucherStatus><![CDATA[POST]]></voucherStatus>
					<client_ID><![CDATA[101001]]></client_ID>
				</e>

Each invoice has a few fields that I am grabbing and also the sumbilling section.

Grabbing each node (batchnumber, invoice, client id, etc) no problem using selectSingleNode.

List <VTDElement> list = doc.selectNodes("root/clientsWithVouchers/billingClient/e/root/e");
for (VTDElement ex : list)
{
    VTDElement elBatch = ex.selectSingleNode("batchNumber");
    VTDElement elInvoice = ex.selectSingleNode("invoice");
    VTDElement elDate = ex.selectSingleNode("payDate");
    VTDElement elClient = ex.selectSingleNode("client_ID");
    VTDElement elLocation = ex.selectSingleNode("location");

    String strBatch = elBatch == null ? "" : elBatch.getText();
    String strInvoice = elInvoice == null ? "" : elInvoice.getText();
    String strDate = elDate == null ? "" : elDate.getText();
    String strClient = elClient == null ? "" : elClient.getText();
    String strLocation = elLocation == null ? "" : elLocation.getText();

but I also want to grab the entire sumBilling node and all of its data. If I use selectSingleNode like above, I retrieve no data. I assume it only grabs the value of that node and not any children. What would be the proper way to retrieve the entire sumBilling node?

Thanks

You have to select each row under sumBilling as a list, just like is done in your outer loop.

Something like:

List<VTDElement> listChildren = ex.selectNodes("sumBilling/e");

Ok. So there isn’t a way to grab the entire sumbilling node and all its children in one?

I don’t think so, no.

ok. I works by looping through each of the sumbilling/e just trying to be more efficient since I want everything that is under the sumBilling.

Thanks