By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

parent tag in XML is repeated. How to defined in DTD that one tag is required for its

P: 1
Hello,


I have the below DTD :

Expand|Select|Wrap|Line Numbers
  1. <!ELEMENT CHART_OF_ACCOUNTS ( ACCOUNTS+ ) > <!ELEMENT ACCOUNTS ( ACCOUNT* ) > <!ELEMENT ACCOUNT ( ORACLE_ACCOUNT_CODE*, DESCRIPTION*, ENABLED_FLAG*, START_DATE_ACTIVE*, END_DATE_ACTIVE*, ACCOUNT_TYPE*, SUN_ACCOUNT_CODE*, BUSINESS_UNITS+, EXTRACTION_DATE* ) > <!ELEMENT ORACLE_ACCOUNT_CODE ( #PCDATA ) > <!ELEMENT DESCRIPTION ( #PCDATA ) > <!ELEMENT ENABLED_FLAG ( #PCDATA ) > <!ELEMENT START_DATE_ACTIVE ( #PCDATA ) > <!ELEMENT END_DATE_ACTIVE ( #PCDATA ) > <!ELEMENT ACCOUNT_TYPE ( #PCDATA ) > <!ELEMENT SUN_ACCOUNT_CODE ( #PCDATA ) > <!ELEMENT BUSINESS_UNITS ( BUSINESS_UNIT* ) > <!ELEMENT BUSINESS_UNIT ( ENTITY*, ENABLED* ) > <!ELEMENT ENTITY ( #PCDATA ) > <!ELEMENT ENABLED ( #PCDATA ) > <!ELEMENT EXTRACTION_DATE ( #PCDATA ) >


This leads to an XML result like this:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8" standalone='no'?> <!DOCTYPE CHART_OF_ACCOUNTS SYSTEM "XXPRI_COA_MASTER.dtd">  <CHART_OF_ACCOUNTS> <ACCOUNTS> <ACCOUNT> <ORACLE_ACCOUNT_CODE>314110</ORACLE_ACCOUNT_CODE> <DESCRIPTION>314101 - RBS TRADE BANK ACCOUNT - EUR</DESCRIPTION> <ENABLED_FLAG>Y</ENABLED_FLAG> <START_DATE_ACTIVE/> <END_DATE_ACTIVE/> <ACCOUNT_TYPE>A</ACCOUNT_TYPE> <SUN_ACCOUNT_CODE>314101</SUN_ACCOUNT_CODE> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>00000</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10401</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10702</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10901</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21101</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21102</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41667</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41668</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41669</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41676</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41688</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <EXTRACTION_DATE>2016-12-01T11:42:41</EXTRACTION_DATE> </ACCOUNT> </ACCOUNTS> <ACCOUNTS> <ACCOUNT> <ORACLE_ACCOUNT_CODE>100600</ORACLE_ACCOUNT_CODE> <DESCRIPTION>100600 - Freehold Land</DESCRIPTION> <ENABLED_FLAG>Y</ENABLED_FLAG> <START_DATE_ACTIVE/> <END_DATE_ACTIVE/> <ACCOUNT_TYPE>A</ACCOUNT_TYPE> <SUN_ACCOUNT_CODE>100600</SUN_ACCOUNT_CODE> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>00000</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10401</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10702</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10901</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21101</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21102</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41667</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41668</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41669</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41676</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41688</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <EXTRACTION_DATE>2016-12-01T11:42:41</EXTRACTION_DATE> </ACCOUNT> </ACCOUNTS> <ACCOUNT> <ORACLE_ACCOUNT_CODE>314115</ORACLE_ACCOUNT_CODE> <DESCRIPTION>RBS TRADE BANK ACCOUNT - EUR - Clearing</DESCRIPTION> <ENABLED_FLAG>Y</ENABLED_FLAG> <START_DATE_ACTIVE/> <END_DATE_ACTIVE/> <ACCOUNT_TYPE>A</ACCOUNT_TYPE> <SUN_ACCOUNT_CODE>314115</SUN_ACCOUNT_CODE> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>00000</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10401</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10702</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>10901</ENTITY> <ENABLED>Y</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21101</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>21102</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41667</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41668</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41669</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41676</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <BUSINESS_UNITS> <BUSINESS_UNIT> <ENTITY>41688</ENTITY> <ENABLED>N</ENABLED> </BUSINESS_UNIT> </BUSINESS_UNITS> <EXTRACTION_DATE>2016-12-01T11:42:41</EXTRACTION_DATE> </ACCOUNT> </ACCOUNTS> </CHART_OF_ACCOUNTS>


As we can see I have ACCOUNTS and BUSINESS UNITS tags surrounding each ACCOUNT and BUSINESS UNIT. I want to have one ACCOUNTS and then listed ACCOUNT and 1 BUSINESS UNITS and listed all the BUSINESS UNITS.

Any ideas?

Thanks in advance!
Dec 1 '16 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
so you don't know how to put your requirement into a DTD rule?
Dec 1 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.