Package org.w3c.dom

Examples of org.w3c.dom.DocumentType


  /// @synopsis Node getDocumentType()
  /// @return document type of <i>document</i> node
  public Any m_getDocumentType()
  {
    if (_type == Node.DOCUMENT_NODE) {
      DocumentType docType = ((Document)_node).getDoctype();
      if (docType != null) {
        return new AnyNode(docType);
      }
    }
    return NULL;
View Full Code Here


       
        try {
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
           
            DOMImplementation impl = builder.getDOMImplementation();
            DocumentType doctype = impl.createDocumentType("wms", "WMT_MS_Capabilities",
                    "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd");
            doc = impl.createDocument(null, "WMT_MS_Capabilities", doctype);
        } catch (javax.xml.parsers.ParserConfigurationException ex) {
            throw new RuntimeException("Cannot create new Xml Document:" + ex.getMessage());
        }
View Full Code Here

    if (mXMLRequestDocument != null)
    {
      /*
       * Set the SystemId with the DTD given in the document
       */
      DocumentType docType = mXMLRequestDocument.getDoctype();
      if (docType != null)
      {
        mRequestDTDSystemID = docType.getSystemId();
      }

      /*
       * Set the function, when a XPath expression is given
       */
 
View Full Code Here

  {
    mXMLResponseDocument = doc;

    if (mXMLResponseDocument != null)
    {
      DocumentType docType = mXMLResponseDocument.getDoctype();
      if (docType != null)
      {
        mResponseDTDSystemID = docType.getSystemId();
      }
    }

    synchronizeResponseFields(destination);
  }
View Full Code Here

      RDFNode dt = schema.dayTimeDuration(m,value);
      if (ym!=null) object.addProperty(RDF.value, ym);
      if (dt!=null) object.addProperty(RDF.value, dt);
    }
    else if (type.endsWith("#ENTITY")) {
      DocumentType doctype = elem.getOwnerDocument().getDoctype();
      Pattern entityPattern = Pattern.compile("<!ENTITY\\s+"+value+"\\s+'(.*)'>");
      Matcher match = entityPattern.matcher(doctype.getInternalSubset());
      if (match.find()) value = match.group(1);
      Literal l = m.createTypedLiteral(value,RDF.getURI()+"XMLLiteral");
      stmt = m.createStatement(subject,prop,l);
    }
    else { // schema datatype?
View Full Code Here

      // such a check.

      try
      // try-catch block for casting standard exceptions to XException
      {
        DocumentType docType = interfaceStructure.getDoctype();
        if (docType != null
            && !docType.getName().equals("InterfaceSpec"))
          throw new XException(Constants.LOCATION_INTERN,
              Constants.LAYER_PROTOCOL,
              Constants.PACKAGE_PROTOCOL_RECORDS, "67");
        if (system == null || system.length() == 0)
          throw new XException(Constants.LOCATION_INTERN,
View Full Code Here

     * Returns the document type public identifier
     * specified for this document, or null.
     */
    public static String whichDoctypePublic( Document doc )
    {
        DocumentType doctype;

           /*  DOM Level 2 was introduced into the code base*/
           doctype = doc.getDoctype();
           if ( doctype != null ) {
           // Note on catch: DOM Level 1 does not specify this method
           // and the code will throw a NoSuchMethodError
           try {
           return doctype.getPublicId();
           } catch ( Error except ) {  }
           }
       
        if ( doc instanceof HTMLDocument )
            return DTD.XHTMLPublicId;
View Full Code Here

     * Returns the document type system identifier
     * specified for this document, or null.
     */
    public static String whichDoctypeSystem( Document doc )
    {
        DocumentType doctype;

        /* DOM Level 2 was introduced into the code base*/
           doctype = doc.getDoctype();
           if ( doctype != null ) {
           // Note on catch: DOM Level 1 does not specify this method
           // and the code will throw a NoSuchMethodError
           try {
           return doctype.getSystemId();
           } catch ( Error except ) { }
           }
       
        if ( doc instanceof HTMLDocument )
            return DTD.XHTMLSystemId;
View Full Code Here

            }
            serializeElement( (Element) node );
            break;
        }
        case Node.DOCUMENT_NODE : {
            DocumentType      docType;
            DOMImplementation domImpl;
            NamedNodeMap      map;
            Entity            entity;
            Notation          notation;
            int               i;
           
            serializeDocument();
           
            // If there is a document type, use the SAX events to
            // serialize it.
            docType = ( (Document) node ).getDoctype();
            if (docType != null) {
                // DOM Level 2 (or higher)
                domImpl = ( (Document) node ).getImplementation();
                try {
                    String internal;

                    _printer.enterDTD();
                    _docTypePublicId = docType.getPublicId();
                    _docTypeSystemId = docType.getSystemId();
                    internal = docType.getInternalSubset();
                    if ( internal != null && internal.length() > 0 )
                        _printer.printText( internal );
                    endDTD();
                }
                // DOM Level 1 -- does implementation have methods?
                catch (NoSuchMethodError nsme) {
                    Class docTypeClass = docType.getClass();

                    String docTypePublicId = null;
                    String docTypeSystemId = null;
                    try {
                        java.lang.reflect.Method getPublicId = docTypeClass.getMethod("getPublicId", (Class[]) null);
                        if (getPublicId.getReturnType().equals(String.class)) {
                            docTypePublicId = (String)getPublicId.invoke(docType, (Object[]) null);
                        }
                    }
                    catch (Exception e) {
                        // ignore
                    }
                    try {
                        java.lang.reflect.Method getSystemId = docTypeClass.getMethod("getSystemId", (Class[]) null);
                        if (getSystemId.getReturnType().equals(String.class)) {
                            docTypeSystemId = (String)getSystemId.invoke(docType, (Object[]) null);
                        }
                    }
                    catch (Exception e) {
                        // ignore
                    }
                    _printer.enterDTD();
                    _docTypePublicId = docTypePublicId;
                    _docTypeSystemId = docTypeSystemId;
                    endDTD();
                }
               
                serializeDTD(docType.getName());
                             
            }
            _started = true;
                    
            // !! Fall through
View Full Code Here

   */
  public String getUnparsedEntityURI(String name, Document doc)
  {

    String url = "";
    DocumentType doctype = doc.getDoctype();

    if (null != doctype)
    {
      NamedNodeMap entities = doctype.getEntities();
      if(null == entities)
        return url;
      Entity entity = (Entity) entities.getNamedItem(name);
      if(null == entity)
        return url;
View Full Code Here

TOP

Related Classes of org.w3c.dom.DocumentType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.