gudii9
asked on
do we need document object to use xpath
Hi,
I am reading as below
create document object as below.
Document document = builder.parse(
new FileInputStream("c:\\custo mers.xml") );
then use XPath by creating an xpath object using XPathFactory.
Reading names of all customers
String expression = "/Customers/Customer/first name";
NodeList nodeList = (NodeList) xPath.compile(expression). evaluate(x mlDocument , XPathConstants.NODESET);
do we need document object to use xpath?
please advise
I am reading as below
create document object as below.
Document document = builder.parse(
new FileInputStream("c:\\custo
then use XPath by creating an xpath object using XPathFactory.
Reading names of all customers
String expression = "/Customers/Customer/first
NodeList nodeList = (NodeList) xPath.compile(expression).
do we need document object to use xpath?
please advise
ASKER
does XPath do not work with SAX(works only DOM). Please advise
Yes, only with DOM
ASKER
why does xpath inspect DOM in between. why does xpath inspect XML directly?
Please advice
Please advice
What do you mean by 'in between'?
ASKER
Document document = builder.parse(
new FileInputStream("c:\\customers.xml") );
I mean above step is extra in between step right(i.e building DOM from the XML) Please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.