here's the perl, edited for brevity
This works pretty good, it produces an output like thisuse XML::Simple; use strict; my $config = XMLin('some.xhtml'); processhash($config,'$config'); sub processhash() { my ($href, $path, @junk) = @_; my %configr = %$href; foreach my $k (keys %configr) { print qq|$path :: $k = $configr{$k}\n|; if ($configr{$k} =~ m/HASH/i) //if it is another hash, iterate + through that hash also { processhash($configr{$k},qq|$path -> {'$k'}|); } } }
for this xml element$config -> {'hx:scriptCollector'} -> {'f:loadBundle'} -> {'bundle_id'} + :: basename = somebasename
if the element has children the script tells me it's a hash<f:loadBundle id="bundle_id" basename="somebasename" var="lbls" />
then process that hash, here's the next few lines of output$config -> {'hx:scriptCollector'} -> {'h:form'} :: h:panelGrid = HASH( +0x1e54150)
$config -> {'hx:scriptCollector'} -> {'h:form'} -> {'h:panelGrid'} -> +{'hruleDots1_panel_id'} :: width = 100% $config -> {'hx:scriptCollector'} -> {'h:form'} -> {'h:panelGrid'} -> +{'hruleDots1_panel_id'} :: columnClasses = hruleDots $config -> {'hx:scriptCollector'} -> {'h:form'} -> {'h:panelGrid'} -> +{'hruleDots1_panel_id'} :: cellspacing = 0
All in all, pretty cool. BUT...the whole point is that I'm going try and find elements that are supposed to have ids but do not.
I will add to the script to check and see if it needs an id property, but even when I do it will fail. It's the strangest thing, sometimes the value of the ID is a child of the element.
For example this elementproduces this from the script<h:outputText styleClass="required" value="*" id="AdjustCCDetails_R +easonCode_table_required_id">
the id propery of the element is a child hash of the element that holds the other properties of the element.{'h:outputText'} :: AdjustCCDetails_ReasonCode_table_required_id = HAS +H(0x1e5400c) {'h:outputText'} -> {'AdjustCCDetails_ReasonCode_table_required_id'} : +: value = * {'h:outputText'} -> {'AdjustCCDetails_ReasonCode_table_required_id'} : +: styleClass = required
here's an example of what I expected XML
script output<h:outputText id="AdjustCCDetails_Comment_table_id" styleClass="label" + value="#{somevalue}">
That output has an id that I can test for, the previous output does not...even though it has a valid id.{'h:panelGrid'} :: h:outputText = HASH(0x1e16050) {'h:panelGrid'} -> {'h:outputText'} :: value = #{somevalue} {'h:panelGrid'} -> {'h:outputText'} :: id = AdjustCCDetails_Comment_ta +ble_id {'h:panelGrid'} -> {'h:outputText'} :: styleClass = label
So my questions are, Do I not understand how all this works? If this is the expected behaviour, how can I test for id properties? and Is there a better way to find all the missing ids from an xhtml file?
In reply to XML::Simple finding id property problem by JohnEl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |