[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to parse XML document with default namespace withJDOM

  • From: Philippe Poulard <philippe.poulard@s...>
  • To: Jack Bush <netbeansfan@y...>
  • Date: Thu, 06 Nov 2008 10:10:00 +0100

Re:  How to parse XML document with default namespace withJDOM

another piece of code that might be useful:

   <xcl:parse-html name="myHtml" source="file:///path/to/file.html"/>
   <xcl:for-each name="myElem" select="{ 
     <xcl:echo value="{ string( $myElem ) }"/>
     <xcl:echo value="{ string( $myElem/@href ) }"/>

the underlying HTML parser is not tagsoup but nekohtml; if your source 
file is XHTML and not HTML, you can simply use <xcl:parse> (an XML 
parser) instead of <xcl:parse-html> (an HTML parser)

I don't really know what happens for a pure HTML source with the XHTML 
namespace, but you can trace what have been parsed by inserting the 
following operation, for example after the for-each statement:
   <xcl:transform source="{ $myHtml }" output="{ $sys:out }"
for pure HTML sources, nekohtml capitalize the elements to be conform to 
the HTML spec (as stated in the nekohtml parser documentation), and it 
must be the same in the XPath expression

to launch the script, just download reflex 
(http://reflex.gforge.inria.fr/) and type in a console:
java -jar reflex-0.3.2.jar run active-sheet.xcl


              (. .)
|      Philippe Poulard       |
        Have the RefleX !

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.