S
soup_or_power
I am unable to preserve white space.
Here is my code:
public class xml {
public static void main(String[] args) {
try{
String jaxpPropertyName = "javax.xml.parsers.SAXParserFactory";
if (System.getProperty(jaxpPropertyName) == null) {
String apacheXercesPropertyValue =
"org.apache.xerces.jaxp.SAXParserFactoryImpl";
System.setProperty(jaxpPropertyName,
apacheXercesPropertyValue);
}
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
Reader reader=new StringReader("<?xml version='1.0'
encoding='UTF-8'?><References><Reference><Name>RITA
MOYER</Name><Address><Street>5001 OAKVIEW DRIVE </Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409678038</Phone><Relationship>MOTHER</Relationship></Reference><Reference><Name>TINA
MASLINSKI</Name><Address><Street>4902 MAPLE VIEW
DRIVE</Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409675992</Phone><Relationship>FRIEND</Relationship></Reference></References>");
InputSource is=new InputSource(reader);
factory.setNamespaceAware(true);
parser.parse(is, new PrintHandler());
} catch(Exception e) {
e.printStackTrace();
}
}
}
I want the parser to show for Name "Rita Moyer". It now shows "Rita"
Thanks for your help
Here is my code:
public class xml {
public static void main(String[] args) {
try{
String jaxpPropertyName = "javax.xml.parsers.SAXParserFactory";
if (System.getProperty(jaxpPropertyName) == null) {
String apacheXercesPropertyValue =
"org.apache.xerces.jaxp.SAXParserFactoryImpl";
System.setProperty(jaxpPropertyName,
apacheXercesPropertyValue);
}
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
Reader reader=new StringReader("<?xml version='1.0'
encoding='UTF-8'?><References><Reference><Name>RITA
MOYER</Name><Address><Street>5001 OAKVIEW DRIVE </Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409678038</Phone><Relationship>MOTHER</Relationship></Reference><Reference><Name>TINA
MASLINSKI</Name><Address><Street>4902 MAPLE VIEW
DRIVE</Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409675992</Phone><Relationship>FRIEND</Relationship></Reference></References>");
InputSource is=new InputSource(reader);
factory.setNamespaceAware(true);
parser.parse(is, new PrintHandler());
} catch(Exception e) {
e.printStackTrace();
}
}
}
I want the parser to show for Name "Rita Moyer". It now shows "Rita"
Thanks for your help