Brian Faull <[EMAIL PROTECTED]> writes:

> Thank you so much for the quick response! I really appreciate it.

Welcome.

> I'm trying to do precisely those two things: an ActivePerl module and
> generate some example code, so I'll be happy to contribute as soon as I
> have my head around the intended usage of the API!

Excellent, that will be very helpful. Email the list if you have any
API questions - I like to have the answers archived so that other
users can locate them in the list archives or in the official:
Distributed Tech Library(TM) ... (aka. Google).

> I'm trying to do one simple thing... grab the entire contents of the XML
> file as a big hash... much like XML::Simple. 

Ok. That would be a useful application to have.

> I've got the tags that have attributes using getAttributes -- very
> easy. However, stepping through an element that has a number of
> children, then (recursively) constructing a hash is utterly
> painful. Since this is DOM, I presume that this structure already
> exists in memory anyway... is there any way to access this with
> Perl? DomDocument->to_hash()!?

I would use the DOMNodeIterator API to automatically walk the tree
(you could also use the DOMTreeWalker API, but I think NodeIterator is
the officially supported one). Check out t/DOMNodeIterator.t to see
how to do it. The trick is to create a filter that only accepts
Element nodes, and then keep a stack of the current DOMElement's and
you can use the equality operator to test who is the parent of the
current node. 

Let me see if I can whip something up.

> I'm sure you get plenty of emails like this -- I'll email the list too. If
> you've got a quick solution, though, I'd be happy to entertain it!

It's better to email the list - that way it gets archived.

Cheers,
jas.

> Thanks again for your help,
> -brian
> 
> 
> "Jason E. Stewart" wrote:
> > 
> > Brian Faull <[EMAIL PROTECTED]> writes:
> > 
> > > I'm working on a project in Perl that involves a lot of XML parsing,
> > > XML::Simple isn't cutting it anymore; we're looking into Xerces; we need
> > > to be portable so Win32 support is a must. Xerces looks great except for
> > > the no-windows support.
> > 
> > Hi Brian,
> > 
> > My appologies, but the Xerces-p web page is *really* out of date. We
> > are at release 2.3.0-3, and yes, there is Win32 support.
> > 
> > Check out the archives of the dev list for Oct and Nov at:
> > 
> >   http://nagoya.apache.org/eyebrowse/SummarizeList?listId=86
> > 
> > Martin Raspe has been working on this, and has gotten good results.
> > 
> > >  - Is there an archive tarball of the last (1.3.3-try3) Win32-supported
> > > release? (can't find it anywhere...)
> > 
> > You should be able to build the existing code with VC++ 6.
> > 
> > >  - Need help with the Windows port? Might be able to throw some time
> > >    at it...
> > 
> > Yes! Martin has been doing great, but I would love to get a packaged
> > binary (a PPM module for ActivePerl), plus debugging some of the
> > exception handling problems is always appreciated.
> > 
> > Other things would be example code files to include with the project
> > or just short tutorials on how to get started.
> > 
> > Cheers,
> > jas.
> 
> -- 
> Brian Faull
> Senior Integrated Electronics Engineer
> D620 - Communications and Networking
> The MITRE Corporation
> 202 Burlington Road, MS E015
> Bedford, MA 01730-1420
> V:781.271.5736  F:781.271.8875
> mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to