Решение XML Split & Name - PullRequest
       9

Решение XML Split & Name

0 голосов
/ 18 октября 2019

Мне нужно не только разделить XML-файл, но и иметь имя выходного файла на основе элемента в XML-файле. (мои файлы обычно меньше 10 мб) пример xml

<Default>

	<Item>
		<ItemID>2420</ItemID>
		<PropertyAddress>602 JUDY WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3700</Land>
		<Total>3700</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3700</CountyTaxable>
		<SchoolTaxable>3700</SchoolTaxable>
		<Lot>108</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.05</LotSize>
		<ParcelNumber>1100330054</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247618</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330054</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92F5A53F4F204EBB31&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$98.28</AmountPaid>
		<Amount2>$30.54</Amount2>
	</Item>

	<Item>
		<ItemID>2421</ItemID>
		<PropertyAddress>604 JUDY WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3700</Land>
		<Total>3700</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3700</CountyTaxable>
		<SchoolTaxable>3700</SchoolTaxable>
		<Lot>109</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.05</LotSize>
		<ParcelNumber>1100330055</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247619</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330055</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92827A739B64FBF36B&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$98.28</AmountPaid>
		<Amount2>$30.54</Amount2>
	</Item>

	<Item>
		<ItemID>2422</ItemID>
		<PropertyAddress>606 JUDY WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3900</Land>
		<Total>3900</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3900</CountyTaxable>
		<SchoolTaxable>3900</SchoolTaxable>
		<Lot>110</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.07</LotSize>
		<ParcelNumber>1100330056</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247620</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330056</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92FF5F6852565D1073&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$103.59</AmountPaid>
		<Amount2>$32.19</Amount2>
	</Item>

	<Item>
		<ItemID>2423</ItemID>
		<PropertyAddress>301 THEODORA WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>4100</Land>
		<Total>4100</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>4100</CountyTaxable>
		<SchoolTaxable>4100</SchoolTaxable>
		<Lot>66</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.10</LotSize>
		<ParcelNumber>0902830096</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247532</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>0902830096</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92E895783D330317BA&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$108.90</AmountPaid>
		<Amount2>$33.84</Amount2>
	</Item>

	<Item>
		<ItemID>2424</ItemID>
		<PropertyAddress>309 THEODORA WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3900</Land>
		<Total>3900</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3900</CountyTaxable>
		<SchoolTaxable>3900</SchoolTaxable>
		<Lot>70</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.07</LotSize>
		<ParcelNumber>1100330175</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247739</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330175</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A9288F5A4310B2D1B4D&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$103.59</AmountPaid>
		<Amount2>$32.19</Amount2>
	</Item>

	<Item>
		<ItemID>2425</ItemID>
		<PropertyAddress>311 THEODORA WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3700</Land>
		<Total>3700</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3700</CountyTaxable>
		<SchoolTaxable>3700</SchoolTaxable>
		<Lot>71</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.05</LotSize>
		<ParcelNumber>1100330174</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247738</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330174</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92A434871565CBB77C&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$98.28</AmountPaid>
		<Amount2>$30.54</Amount2>
	</Item>

конечный результат, который мне нужен для каждого содержимого выходного файла - -

<Default>

	<Item>
		<ItemID>2420</ItemID>
		<PropertyAddress>602 JUDY WAY</PropertyAddress>
		<Subdivision>CHESTNUT HILL PRESERVE</Subdivision>
		<Owner>TAC CHESTNUT HILL LLC</Owner>
		<MunicipalInfo>Unincorporated</MunicipalInfo>
		<Land>3700</Land>
		<Total>3700</Total>
		<Structure>0</Structure>
		<Homesite></Homesite>
		<CountyTaxable>3700</CountyTaxable>
		<SchoolTaxable>3700</SchoolTaxable>
		<Lot>108</Lot>
		<PropertyClass>RESIDENTIAL</PropertyClass>
		<LotSize>0.05</LotSize>
		<ParcelNumber>1100330054</ParcelNumber>
		<ScreenShotPage-Overview>http://www3.nccde.org/parcel/Details/Default.aspx?ParcelKey=247618</ScreenShotPage-Overview>
		<SaleAmount>$10.00</SaleAmount>
		<SaleDate>11/17/2017</SaleDate>
		<InputParcelID>1100330054</InputParcelID>
		<taxBill><![CDATA[http://www3.nccde.org/PDFDocument/default.aspx?DocumentID=80:5538A80CA926BC49834398A8F3E7191F27D6313B08EF2B0C462AD31F517C0A92F5A53F4F204EBB31&x=temp.pdf]]></taxBill>
		<Error></Error>
		<BatchID>69633</BatchID>
		<ClientName>Ardent Companies</ClientName>
		<Countydue>$0.00</Countydue>
		<SchoolDue>$0.00</SchoolDue>
		<AmountPaid>$98.28</AmountPaid>
		<Amount2>$30.54</Amount2>
	</Item>

Имена выходных файлов должны иметь имя ItemID.xml

Если найдены решения для его разделения, но не называть его в зависимости от содержимого. Ищете любое программное обеспечение или решение кода. Спасибо!

...