A
Amol
Hi,
I want to fetch some values from a XML file, using a java program.
I want to retrieve value of path tag for e.g<path>some path</path>
tag.(Marked with **** in the below XML file Example)
=============
My XML File
============
<maindata id="U00abfd8a-0ce7-ced5-00f6-00fff5bfdea9" host="e05k02"
addr="10.64.33.86" domain="BrioPortal 7.0 Development"
version="7.0.1.17" date="2003-08-04 14:20:23-07">
<Category name="MigSMACT" version="7.0.1.17"
id="U01929031-0e01-ced5-00f6-00fff5bfdea9">
<gendate>2003-08-04 14:20:25-07</gendate>
<cattribs>
<autodelete>false</autodelete>
<browsable>true</browsable>
<datecreated>2003-07-28&sp;14:35:33-07</datecreated>
<description>New&sp;Category</description>
<group name="ADMINISTRATOR"
idref="U0159c5ff-13e4-ced5-00f6-00fff5bfdea9"/>
<lastmodified>2003-07-28&sp;14:35:33-07</lastmodified>
<name>MigSMACT</name>
<objectid>HXLWIRBZFXECHBDYAGHLIRRPZe0Ck0N-BCRRP_Z0FK0N</objectid>
<objecttype mimetype="Category"
idref="U00d5f038-13e8-ced5-00f6-00fff5bfdea9"/>
<owner name="dw1portl"
idref="U0057d3f5-143b-ced5-00f6-00fff5bfdea9"/>
<parentcategory name="Migration Staging"
idref="U001c7c0d-1456-ced5-00f6-00fff5bfdea9"/>
<parentobjectid>FBRGZLXIDHCITIDYG0R0LLP_eZFkZC-FCLRB_E0FM0C</parentobjectid>
****** <path>/ABC&sp;Shipping/Goods&sp;Sale/Final</path> *******
<permissions>
<Permissions>
<groupexecutepermission>true</groupexecutepermission>
<groupreadpermission>true</groupreadpermission>
<groupwritepermission>true</groupwritepermission>
<ownerexecutepermission>true</ownerexecutepermission>
<ownerreadpermission>true</ownerreadpermission>
<ownerwritepermission>true</ownerwritepermission>
<worldexecutepermission>true</worldexecutepermission>
<worldreadpermission>true</worldreadpermission>
<worldwritepermission>true</worldwritepermission>
</Permissions>
</permissions>
</cattribs>
</Category>
==============
My Java Code
=============
DOMParser tParser = new DOMParser();
tParser.parse("WRTest_11-28-5:38_sdw-sb.xml");
Document doc = tParser.getDocument();
doc.getDocumentElement ();
System.out.println ("Root element :" +
doc.getDocumentElement().getNodeName());
NodeList objCatNodes = doc.getElementsByTagName("path");
int totalCatNodes = objCatNodes.getLength();
System.out.println("Total no of Path tags: " + totalCatNodes);
Node objNode=objCatNodes.item(0);
System.out.println("Path Name : " + objNode.getNodeName());
-------------------------------------
In the last System.out.println, it is returning NULL.
Please tell me what I need to do, to get the value. Plz help me its
Urgent. thanks in advance.
Amy..........
I want to fetch some values from a XML file, using a java program.
I want to retrieve value of path tag for e.g<path>some path</path>
tag.(Marked with **** in the below XML file Example)
=============
My XML File
============
<maindata id="U00abfd8a-0ce7-ced5-00f6-00fff5bfdea9" host="e05k02"
addr="10.64.33.86" domain="BrioPortal 7.0 Development"
version="7.0.1.17" date="2003-08-04 14:20:23-07">
<Category name="MigSMACT" version="7.0.1.17"
id="U01929031-0e01-ced5-00f6-00fff5bfdea9">
<gendate>2003-08-04 14:20:25-07</gendate>
<cattribs>
<autodelete>false</autodelete>
<browsable>true</browsable>
<datecreated>2003-07-28&sp;14:35:33-07</datecreated>
<description>New&sp;Category</description>
<group name="ADMINISTRATOR"
idref="U0159c5ff-13e4-ced5-00f6-00fff5bfdea9"/>
<lastmodified>2003-07-28&sp;14:35:33-07</lastmodified>
<name>MigSMACT</name>
<objectid>HXLWIRBZFXECHBDYAGHLIRRPZe0Ck0N-BCRRP_Z0FK0N</objectid>
<objecttype mimetype="Category"
idref="U00d5f038-13e8-ced5-00f6-00fff5bfdea9"/>
<owner name="dw1portl"
idref="U0057d3f5-143b-ced5-00f6-00fff5bfdea9"/>
<parentcategory name="Migration Staging"
idref="U001c7c0d-1456-ced5-00f6-00fff5bfdea9"/>
<parentobjectid>FBRGZLXIDHCITIDYG0R0LLP_eZFkZC-FCLRB_E0FM0C</parentobjectid>
****** <path>/ABC&sp;Shipping/Goods&sp;Sale/Final</path> *******
<permissions>
<Permissions>
<groupexecutepermission>true</groupexecutepermission>
<groupreadpermission>true</groupreadpermission>
<groupwritepermission>true</groupwritepermission>
<ownerexecutepermission>true</ownerexecutepermission>
<ownerreadpermission>true</ownerreadpermission>
<ownerwritepermission>true</ownerwritepermission>
<worldexecutepermission>true</worldexecutepermission>
<worldreadpermission>true</worldreadpermission>
<worldwritepermission>true</worldwritepermission>
</Permissions>
</permissions>
</cattribs>
</Category>
==============
My Java Code
=============
DOMParser tParser = new DOMParser();
tParser.parse("WRTest_11-28-5:38_sdw-sb.xml");
Document doc = tParser.getDocument();
doc.getDocumentElement ();
System.out.println ("Root element :" +
doc.getDocumentElement().getNodeName());
NodeList objCatNodes = doc.getElementsByTagName("path");
int totalCatNodes = objCatNodes.getLength();
System.out.println("Total no of Path tags: " + totalCatNodes);
Node objNode=objCatNodes.item(0);
System.out.println("Path Name : " + objNode.getNodeName());
-------------------------------------
In the last System.out.println, it is returning NULL.
Please tell me what I need to do, to get the value. Plz help me its
Urgent. thanks in advance.
Amy..........