Palani kumar

Greenhorn
+ Follow
since Sep 01, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Palani kumar

hai all
i want to add a xsl stylesheet parameter to the xml dom object i am constructing.actually i created a new processing instruction object and gave the file path to the xsl file .but it does not get appended.I am using xerces 1.4.3 parser.
Anyone know
Please explain

Cheers
Palanikumar
Hai all
What is Document Fragment ? Can i create a document fragment without a root document object.
Can anyone help me how to use document fragment in java
Thanks
Palanikumar
------------------
In the end everything is Right,If it's not then It's not the End
Hai
there is an method in Document to create comment
Comment comment = Document.createComment("Specify comment to be added");
then as usual you can append as a child to the node you want to add using the appendChild() method

Cheers
Palanikumar

------------------
In the end everything is Right,If it's not then It's not the End
Hei
after parsing you can take the values by getting to the node
you can take this by using the method
NodeList nl = Document.getElementsByTagName("INVOICENO");
as shown above this gives all the elements with the said name.
Node invoice= nl.item(0); \\this gives you the code the value '0' denotes the first element
Node value = invoice.getFirstChild(); \\this gives the text node from where you can take the value
String s = value.getNodeValue();
Hope this helps
Cheers
:-)
Palanikumar
------------------
In the end everything is Right,If it's not then It's not the End
Hai anyone know how to add a Processing Instruction for xml-stylesheet
I am using xerces 1.4.3 parser
i used
Document.createProcessingInstruction("xml-stylesheet","Tables.xsl");
and appended to the document and am taking the output through a xml serializer.
Apparently i dont get the PI i am setting
Anyone advice pls
Thanks
Palanikumar
------------------
In the end everything is Right,If it's not then It's not the End
Hai
you can do so like this if you want to duplicate some nodes
Document doc = dom.getDocument();
Element clone = (Element)doc.getElementsByTagName("name").item(0);
Node cloned = (Element)doc.importNode(clone,true);
doc.getDocumentElement().appendChild(cloned);
the boolean argument in the importNode() method is set to true if you want all the subnodes and values ,If it's set to false,then you will get only an empty node

Hope it helps
Cheers
Palanikumar

------------------
In the end everything is Right,If it's not then It's not the End
[This message has been edited by Palani kumar (edited October 06, 2001).]
Hai this works fine
i tested it in xerces1.4.3.actually the encoding ="UTF-8" gets included in doing so.

Document doc = new DocumentImpl();
doc.appendChild((Element)doc.createElement("root"));
ProcessingInstruction PI= doc.createProcessingInstruction("xml","version=\"1.0\"");
doc.appendChild((Node)PI);
Hope it helps

:-)
Palanikumar

------------------
In the end everything is Right,If it's not then It's not the End
[This message has been edited by Palani kumar (edited October 06, 2001).]
if you have to get the value for "name"
you can do so like this
document.getElementByTagName("login").item(0).getFirstChild().getNodeValue();
Cheers
Palanikumar
------------------
In the end everything is Right,If it's not then It's not the End
if you have to get the value for "name"
you can do so like this
document.getElementByTagName("login").item(0).getFirstChild().getNodeValue();
Cheers
Palanikumar
Hai all
any one knew resources for using XPath
?
------------------
In the end everything is Right,If it's not then It's not the End
are there any resources for JTAPI for beginners ?
23 years ago
hai all
I am using JAXP 1.1 parser .I have a problem in porting elements from one document to Another Document .Does JAXP 1.1 Support doing this .i am getting an error stating that the element belongs to another document
Please advice