You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ryanburnette We will keep a detailed log of the structure of the XML files here for the purpose of accessing particular regs.
CFRDOC
x = Aviation14CFR.data x.children[1].children[5] => TITLE x.children[1].children[5].children[7] => CHAPTER (contains all the relevant regs)
CHAPTER
Below the CHAPTER heading, the file contains a Table of Contents and the individual subchapters for that chapter. In Title 14, Chapter I is divided into Volumes 1 - 3 that correspond to each file that we have downloaded.
x.children[1].children[5].children[7].children[1]
Returns TOC
Table of Contents for the entire CHAPTER
x.children[1].children[5].children[7].children[x]
Returns SUBCHAP
Contains individual parts pertaining to that subchapter
x can be any odd integer above 1, up to the number of subchapters contained in that volume plus 4
Example: Volume 1 contains 3x SUBCHAP. Therefore, each SUBCHAP can be accessed with values of 3, 5, and 7 for x
x.children[1] => CFRDOC x.children[1].children[5] => TITLE x.children[1].children[5].children[7] => CHAPTER => Chapter I, FAA, DOT x.children[1].children[5].children[7].children[3] =>SUBCHAP => Subchapter A - Definitions and General Requirements x.children[1].children[5].children[7].children[3].children[7] => PART => Part 3 - General Requirements x.children[1].children[5].children[7].children[3].children[7].children[13] => SECTION => § 3.5 x.children[1].children[5].children[7].children[3].children[7].children[13].children[7] => P x.children[1].children[5].children[7].children[3].children[7].children[13].children[7].children[2]
Example to Find 14 CFR 3.5
x.xpath("/CFRDOC/TITLE/CHAPTER/SUBCHAP[1]/PART[2]/SECTION[2]/P[2]").text =>
"\n Airworthy means the aircraft conforms to its type design and is ..."
It appears that the xpath above still contains children. Child[0] contains the "\n " while [1] and [2] actually contain the text we desire. My guess is that this is due to formatting requirements on the ecfr.gov website specifically for definitions. Only time will tell, but I do not think that every reg will have this. And even if it does, I don't necessarily think there's anything wrong with keeping the format to match.
We can also run .length on the xpath request to determine if a given request will return empty or not.
Notes
The even numbered children always (in every case I can find, at least) contain a string that just adds a line break.
It appears that the .children[0] usually returns the text within a tag
The text was updated successfully, but these errors were encountered:
@ryanburnette We will keep a detailed log of the structure of the XML files here for the purpose of accessing particular regs.
CFRDOC
x = Aviation14CFR.data
x.children[1].children[5]
=> TITLEx.children[1].children[5].children[7]
=> CHAPTER (contains all the relevant regs)CHAPTER
Below the
CHAPTER
heading, the file contains a Table of Contents and the individual subchapters for that chapter. In Title 14, Chapter I is divided into Volumes 1 - 3 that correspond to each file that we have downloaded.x.children[1].children[5].children[7].children[1]
TOC
CHAPTER
x.children[1].children[5].children[7].children[x]
SUBCHAP
x
can be any odd integer above 1, up to the number of subchapters contained in that volume plus 4SUBCHAP
Where
x
pertains to the desiredSUBCHAP
...x.children[1].children[5].children[7].children[x].children[3]
HD
SUBCHAP
namePART
x.children[1].children[5].children[7].children[x].children[y]
PART
SUBPART
(where applicable) orSECTION
y
must be an odd integer above 5 but no greater than the number ofSUBCHAP
(if applicable) orSECTION
plus 6 (don't hold me to that, yet)x.children[1].children[5].children[7].children[x].children[y].children[5]
CONTENTS
SECTION
for that givenPART
SUBPART
x.children[1].children[5].children[7].children[x].children[y]
SECTION
If no
SUBPART
exists, the following will open to a specificSECTION
x.children[1].children[5].children[7].children[x].children[y]
Example to Find 14 CFR 3.5
It appears that the
xpath
above still contains children. Child[0] contains the "\n " while [1] and [2] actually contain the text we desire. My guess is that this is due to formatting requirements on the ecfr.gov website specifically for definitions. Only time will tell, but I do not think that every reg will have this. And even if it does, I don't necessarily think there's anything wrong with keeping the format to match.We can also run
.length
on thexpath
request to determine if a given request will return empty or not.Notes
.children[0]
usually returns the text within a tagThe text was updated successfully, but these errors were encountered: