D
David Sainte-claire
Hello,
This is really weird, and I'm not sure if maybe there's a formatting
option that I can set on the puts method that will solve it. Hopefully
someone has done something similar??
I have been using REXML to parse through an XML document that I get back
from calling a ReST-ish web service, and up until now it has parsed
every single element as I'd expect. But I run into this small patch of
data were it acts weird. The XML looks like this:
<profile>
<support>
<title>eSupport</title>
<prefix>Find related product support and help in</prefix>
<link>
http://www.somecompany.com/US/perl/model-home.pl?XID=M:products:crmportal&LOC=3&mdl=someModel
</link>
</support>
</profile>
And I'm parsing it like this:
data.elements.each("product/profile/support"){|element|
element.elements.each() do |child|
puts "Did XPATH match any profile elements?"
puts child.text
end
}
I know it's pretty rudimentary, but I'm just confused as to why this
same pattern has been able to get text out of every other element I have
searched for, but here I get something like this when I loop through the
subelemenents:
Did XPATH match any profile elements?
???Product_Support_Link_Title???
Did XPATH match any profile elements?
???Product_Support_Link_Prefix???
Did XPATH match any profile elements?
???Product_Support_Link???&mdl=someModel
It looks like XPATH doesn't like the format of the text somehow, but I
have no idea what it is about it that it doesn't like since it appears
to be just normal text to me.
Anyone have any ideas? It looks like something that REXML is doing
since it outputs the path to the element in the document Product -->
Support but I don't have a clue where the _Link is coming from?
Thanks in advance for all your help!
David
This is really weird, and I'm not sure if maybe there's a formatting
option that I can set on the puts method that will solve it. Hopefully
someone has done something similar??
I have been using REXML to parse through an XML document that I get back
from calling a ReST-ish web service, and up until now it has parsed
every single element as I'd expect. But I run into this small patch of
data were it acts weird. The XML looks like this:
<profile>
<support>
<title>eSupport</title>
<prefix>Find related product support and help in</prefix>
<link>
http://www.somecompany.com/US/perl/model-home.pl?XID=M:products:crmportal&LOC=3&mdl=someModel
</link>
</support>
</profile>
And I'm parsing it like this:
data.elements.each("product/profile/support"){|element|
element.elements.each() do |child|
puts "Did XPATH match any profile elements?"
puts child.text
end
}
I know it's pretty rudimentary, but I'm just confused as to why this
same pattern has been able to get text out of every other element I have
searched for, but here I get something like this when I loop through the
subelemenents:
Did XPATH match any profile elements?
???Product_Support_Link_Title???
Did XPATH match any profile elements?
???Product_Support_Link_Prefix???
Did XPATH match any profile elements?
???Product_Support_Link???&mdl=someModel
It looks like XPATH doesn't like the format of the text somehow, but I
have no idea what it is about it that it doesn't like since it appears
to be just normal text to me.
Anyone have any ideas? It looks like something that REXML is doing
since it outputs the path to the element in the document Product -->
Support but I don't have a clue where the _Link is coming from?
Thanks in advance for all your help!
David