• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to generete correkt xml from string, with elementsByTagNameNS.item(0));

 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My program works fine, now i want to test it, and want a result in elementsByTagNameNS.item(0)); to return something.

I try to generete the correct xml from a String but elementsByTagNameNS.item(0)); returns null.

Cann i prefix my String, so the item returns something, or how can i do that ?

FJA elementsByTagNameNS: org.apache.xerces.dom.DeepNodeListImpl@25a325a3
FJA elementsByTagNameNS: null





Frank
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have time to test it right now and I'm answering by heart, I think you need to do this after line 7:

 
Frank Jacobsen
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe im on the right track, but get this exception:

[Fatal Error] :1:602: The prefix "ns2" for element "ns2:technicalAddress" is not bound.
org.xml.sax.SAXParseException: The prefix "ns2" for element "ns2:technicalAddress" is not bound.



 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Than happens because there are XML elements which use the namespace "ns2", but there is no "xmlns:ns2=..." declaration to tell the XML parser what the ID for the namespace "ns2" is. So, the XML is incorrect.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic