java.lang.Object
javax.xml.parsers.DocumentBuilder
- See Also:
- Top Examples, Source Code,
DocumentBuilderFactory.newDocumentBuilder()
, Document
protected DocumentBuilder()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[153]Get DOM elements by tag name
By Anonymous on 2005/04/26 17:48:33 Rate
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ( ) ;
DocumentBuilder builder = factory.newDocumentBuilder ( ) ;
Document document = builder.parse ( "priceList.xml" ) ;
NodeList myNL = document.getElementsByTagName ( "price" ) ;
public abstract DOMImplementation getDOMImplementation()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[215]Get DOM implementation
By Anonymous on 2003/04/09 10:48:05 Rate
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ( ) ;
factory.setNamespaceAware ( true ) ;
DocumentBuilder builder = factory.newDocumentBuilder ( ) ;
DOMImplementation impl = builder.getDOMImplementation ( ) ;
public Schema getSchema()
- See Also:
- UnsupportedOperationException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean isNamespaceAware()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract boolean isValidating()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isXIncludeAware()
- See Also:
DocumentBuilderFactory.setXIncludeAware(boolean)
, UnsupportedOperationException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Document newDocument()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[716]Build the blank document in the typical JAXP way
By Anonymous on 2004/04/01 14:12:32 Rate
private Header createSoapHeader2 ( String sessionId ) throws ParserConfigurationException {
// Build the blank document in the typical
// JAXP way
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance ( ) ;
factory.setNamespaceAware ( true ) ;
DocumentBuilder builder=factory.newDocumentBuilder ( ) ; // throws pce
Document doc=builder.newDocument ( ) ;
Header header=new Header ( ) ;
Vector headerEntries=new Vector ( ) ;
// Build our sessionId element via DOM and
// add it to the header
Element sessionIdElement=doc.createElement ( "sessionID" ) ;
sessionIdElement.setAttribute ( "xsi:type","xsd:string" ) ;
sessionIdElement.appendChild ( doc.createTextNode ( sessionId ) ) ;
headerEntries.add ( sessionIdElement ) ;
header.setHeaderEntries ( headerEntries ) ;
return header;
}
public Document parse(File f)
throws SAXException,
IOException
- See Also:
DocumentHandler
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[154]Parse a DOM document
By Anonymous on 2004/02/09 10:15:27 Rate
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance ( ) ;
DocumentBuilder builder = factory.newDocumentBuilder ( ) ;
Document document = builder.parse ( "priceList.xml" ) ;
NodeList myNL = document.getElementsByTagName ( "price" ) ;
public Document parse(InputStream is)
throws SAXException,
IOException
- See Also:
DocumentHandler
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Document parse(InputStream is,
String systemId)
throws SAXException,
IOException
- See Also:
DocumentHandler
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Document parse(String uri)
throws SAXException,
IOException
- See Also:
DocumentHandler
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract Document parse(InputSource is)
throws SAXException,
IOException
- See Also:
DocumentHandler
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void reset()
- See Also:
Object.equals(Object obj)
, ErrorHandler
, EntityResolver
, DocumentBuilderFactory.newDocumentBuilder()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setEntityResolver(EntityResolver er)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public abstract void setErrorHandler(ErrorHandler eh)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1585]Error handler for validating parse
By Anonymous on 2005/11/04 20:23:08 Rate
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance ( ) ;
factory.setValidating ( true ) ;
DocumentBuilder parser = factory.newDocumentBuilder ( ) ;
parser.setErrorHandler ( new ErrorHandler ( ) ) ;
Document doc = parser.parse ( new File ( "aFile.xml" ) ) ;
private static class ErrorHandler implements org.xml.sax.ErrorHandler {
public void warning ( org.xml.sax.SAXParseException ex )
throws org.xml.sax.SAXException {
System.out.println ( "Warning: " + ex.getMessage ( ) ) ;
}
public void error ( org.xml.sax.SAXParseException ex )
throws org.xml.sax.SAXException {
System.out.println ( "Error: " + ex.getMessage ( ) ) ;
}
public void fatalError ( org.xml.sax.SAXParseException ex )
throws org.xml.sax.SAXException {
System.out.println ( "Fatal error: " + ex.getMessage ( ) ) ;
}
}