• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

string to xml

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
I'm trying to pass in a value to the empty tag <ds: Modulus> </ds:Modulus>..brief structure of the xml below:

the Java code:

When it executes the getNodeName; the println returns a value of #text.
I'm not too sure what this means. I'm trying to figure out how to pass the string as a value of the ds:Modulus tag.
I was thinking of using the setNodeValue but this is of type Node.
I'm just really unsure how to go about doing this
Please help - it would be unbelieveably appreciated.
If anyone can do this for me and it works, I will give them my programmatically created keystore/keypair/extracting
keys from keystore and breaking them down into modulus and exponents.
Or I can will have the A*Search algorithm up and running tomorrow
if that's preferred.
[ May 23, 2003: Message edited by: Cindy Glass ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the XML forum.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Emma,
I think the reason you see "#text" as the node name is that the contents of the tag is a series of blanks -- a whitespace, text node.
I'm not sure what result you would get if instead of coding

you coded

Since the latter version is a true no-content element, it really is different than your pair of tags with whitespace between.
If you coded

or whatever, you should be able to get the value as a string, and then try to convert it to a number (int or bigint).
I'm not sure what the problem is.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand you properly, the child of the first ds.Modulus Element is a Text node. Look at the JavaDocs for org.w3c.dom.Node - you will see that for a Text node, getNodeName returns "#text" and getNodeValue returns the text contents.
Bill
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic