Re: XML::Twig beginner
by Ying Liu other posts by this author
Jun 20 2006 2:13PM messages near this date
view in the new Beta List Site
Re: XML::Twig beginner
|
Re: XML::Twig beginner
& XSLT Andreas P�rzer <pue@[...].net> wrote:Please note that you will not find a (XML::Twi
g::)Elt.pm, because
package XML::Twig::Elt lives inside Twig.pm! Furthermore, please note
also that first_elt() is not a method of XML::Twig::Elt, but of XML::Twig!
Did you copy & paste or retype my suggestions? I suspect you retyped and
called first_elt() on $root, which will not work (obviously :-> ) because
$root is a XML::Twig::Elt (obtained from calling root() on $twig) and,
as you noticed, there is no sub first_elt in XML::Twig::Elt.
If you look again at the examples, you will surely note that the first
one uses $twig (a XML::Twig Object), whereas the other two use $root (a
XML::Twig::Elt Object). I hope this clarifies things a little bit.
> >
Andreas, your explication is quite clear. Thanks,
My new question is what is the best way to parse the following XML file. This is just a part
of long long file. I want the text of <configName> <configType> and <type>, <type> is under
<Arg> . Now, I can get <configName> and <configType>. Then, I need to enter <Ports>, <Port>,
<Args> and <Arg> levels and then to get <type> info. Can I just jump some of the tags and g
et <type> directively. I set 'type' at TwigRoots, doesn't work.
Thanks,
Ying
<Vertex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="java:com.hnc.core.co
mmon.graph.config.FlowVertex">
<key> ReadMySchemaObjects</key>
<valid> true</valid>
<configName> ReadMySchemaObjects</configName>
<configType> com.hnc.core.server.activity.atomic.config.DataSourceActivityConfig<
/configType>
<Ports>
<Port xsi:type="java:com.hnc.core.server.activity.atomic.config.ActivityPort
" xmlns="com/hnc/core/server/activity/atomic/config">
<key> out</key>
<use> out</use>
<Args>
<Arg>
<name xmlns="com/hnc/core/common/config/util"> bob</name>
<type xmlns="com/hnc/core/common/config/util"> schema:MySchema</t
ype>
<use xmlns="com/hnc/core/common/config/util"> out</use>
<description xmlns="com/hnc/core/common/config/util"> <![CDATA[My
SchemaDataSetDef - schema:MySchema]]> </description>
</Arg>
</Args>
</Port>
</Ports>
</Vertex>
---------------------------------
Want to be your own boss? Learn how on Yahoo! Small Business.
Thread:
Ying Liu
Ying Liu
Andreas P?rzer
Ying Liu
Andreas Pürzer
Ying Liu
Andreas Pürzer
Andreas Pürzer
Ying Liu
|