Initial commit

This commit is contained in:
github-classroom[bot] 2023-03-06 13:35:46 +00:00 committed by GitHub
commit 5af7724e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
739 changed files with 220926 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
virtualenv/

12
readme.md Normal file
View File

@ -0,0 +1,12 @@
### Information Modelling & Analysis: Project 1
Student: *enter your name here*
### Project instructions:
Please follow the instructions provided in the project slides.
For your convenience, the source code to be analyzed (xerces2)
has already been added to this repository (*/resources/xerces2-j-src*).
**Attention**: Please consider the submission instructions available on iCorsi.
**Report**: You may want to use the template distributed on iCorsi.

View File

@ -0,0 +1,119 @@
Manifest-Version: 1.0
Created-By: @java.version@ (@java.vendor@)
Name: org/apache/xerces/impl/
Comment: @impl.name@
Implementation-Title: org.apache.xerces.impl.Version
Implementation-Version: @impl.version@
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xerces.apache.org/xerces2-j/
Name: org/xml/sax/
Comment: based on xml-commons external 1.4.01
Specification-Title: Simple API for XML
Specification-Vendor: David Megginson
Specification-Version: 2.0.2
Implementation-Title: org.xml.sax
Implementation-Version: 2.0.2
Implementation-Vendor: David Megginson
Implementation-URL: http://www.saxproject.org/
Name: org/w3c/dom/
Comment: based on xml-commons external 1.4.01
Specification-Title: Document Object Model, Level 3 Core
Specification-Vendor: World Wide Web Consortium
Specification-Version: 1.0
Implementation-Title: org.w3c.dom
Implementation-Version: 1.0
Implementation-Vendor: World Wide Web Consortium
Implementation-URL: http://www.w3c.org/DOM/
Name: org/w3c/dom/ls/
Comment: based on xml-commons external 1.4.01
Specification-Title: Document Object Model, Level 3 Load and Save
Specification-Vendor: World Wide Web Consortium
Specification-Version: 1.0
Implementation-Title: org.w3c.dom.ls
Implementation-Version: 1.0
Implementation-Vendor: World Wide Web Consortium
Implementation-URL: http://www.w3c.org/DOM/
Name: javax/xml/stream/
Comment: based on xml-commons external 1.4.01
Specification-Title: Streaming API for XML
Specification-Vendor: BEA Systems, Inc.
Specification-Version: 1.0
Implementation-Title: javax.xml.stream
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/datatype/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.datatype
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/namespace/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.namespace
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/parsers/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.parsers
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/transform/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.transform
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/validation/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.validation
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: javax/xml/xpath/
Comment: based on xml-commons external 1.4.01
Specification-Title: Java API for XML Processing
Specification-Version: 1.4
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: javax.xml.xpath
Implementation-Version: 1.4.01
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xml.apache.org/commons/
Name: org/apache/xerces/xni/
Comment: Xerces Native Interface
Specification-Title: Xerces Native Interface
Specification-Version: 1.2
Specification-Vendor: Apache Software Foundation
Implementation-Title: org.apache.xerces.xni
Implementation-Version: 1.2
Implementation-Vendor: Apache Software Foundation
Implementation-URL: http://xerces.apache.org/xerces2-j/

View File

@ -0,0 +1,210 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLAnchorElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLAnchorElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLAnchorElementImpl
extends HTMLElementImpl
implements HTMLAnchorElement
{
private static final long serialVersionUID = -140558580924061847L;
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public String getCharset()
{
return getAttribute( "charset" );
}
public void setCharset( String charset )
{
setAttribute( "charset", charset );
}
public String getCoords()
{
return getAttribute( "coords" );
}
public void setCoords( String coords )
{
setAttribute( "coords", coords );
}
public String getHref()
{
return getAttribute( "href" );
}
public void setHref( String href )
{
setAttribute( "href", href );
}
public String getHreflang()
{
return getAttribute( "hreflang" );
}
public void setHreflang( String hreflang )
{
setAttribute( "hreflang", hreflang );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getRel()
{
return getAttribute( "rel" );
}
public void setRel( String rel )
{
setAttribute( "rel", rel );
}
public String getRev()
{
return getAttribute( "rev" );
}
public void setRev( String rev )
{
setAttribute( "rev", rev );
}
public String getShape()
{
return capitalize( getAttribute( "shape" ) );
}
public void setShape( String shape )
{
setAttribute( "shape", shape );
}
public int getTabIndex()
{
return this.getInteger( getAttribute( "tabindex" ) );
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getTarget()
{
return getAttribute( "target" );
}
public void setTarget( String target )
{
setAttribute( "target", target );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
public void blur()
{
// No scripting in server-side DOM. This method is moot.
}
public void focus()
{
// No scripting in server-side DOM. This method is moot.
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLAnchorElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,178 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLAppletElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLAppletElement
* @see HTMLElementImpl
*/
public class HTMLAppletElementImpl
extends HTMLElementImpl
implements HTMLAppletElement
{
private static final long serialVersionUID = 8375794094117740967L;
public String getAlign()
{
return getAttribute( "align" );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getAlt()
{
return getAttribute( "alt" );
}
public void setAlt( String alt )
{
setAttribute( "alt", alt );
}
public String getArchive()
{
return getAttribute( "archive" );
}
public void setArchive( String archive )
{
setAttribute( "archive", archive );
}
public String getCode()
{
return getAttribute( "code" );
}
public void setCode( String code )
{
setAttribute( "code", code );
}
public String getCodeBase()
{
return getAttribute( "codebase" );
}
public void setCodeBase( String codeBase )
{
setAttribute( "codebase", codeBase );
}
public String getHeight()
{
return getAttribute( "height" );
}
public void setHeight( String height )
{
setAttribute( "height", height );
}
public String getHspace()
{
return getAttribute( "height" );
}
public void setHspace( String height )
{
setAttribute( "height", height );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getObject()
{
return getAttribute( "object" );
}
public void setObject( String object )
{
setAttribute( "object", object );
}
public String getVspace()
{
return getAttribute( "vspace" );
}
public void setVspace( String vspace )
{
setAttribute( "vspace", vspace );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLAppletElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,150 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLAreaElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLAreaElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLAreaElementImpl
extends HTMLElementImpl
implements HTMLAreaElement
{
private static final long serialVersionUID = 7164004431531608995L;
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public String getAlt()
{
return getAttribute( "alt" );
}
public void setAlt( String alt )
{
setAttribute( "alt", alt );
}
public String getCoords()
{
return getAttribute( "coords" );
}
public void setCoords( String coords )
{
setAttribute( "coords", coords );
}
public String getHref()
{
return getAttribute( "href" );
}
public void setHref( String href )
{
setAttribute( "href", href );
}
public boolean getNoHref()
{
return getBinary( "nohref" );
}
public void setNoHref( boolean noHref )
{
setAttribute( "nohref", noHref );
}
public String getShape()
{
return capitalize( getAttribute( "shape" ) );
}
public void setShape( String shape )
{
setAttribute( "shape", shape );
}
public int getTabIndex()
{
return getInteger( getAttribute( "tabindex" ) );
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getTarget()
{
return getAttribute( "target" );
}
public void setTarget( String target )
{
setAttribute( "target", target );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLAreaElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLBRElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLBRElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLBRElementImpl
extends HTMLElementImpl
implements HTMLBRElement
{
private static final long serialVersionUID = 311960206282154750L;
public String getClear()
{
return capitalize( getAttribute( "clear" ) );
}
public void setClear( String clear )
{
setAttribute( "clear", clear );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLBRElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLBaseElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLBaseElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLBaseElementImpl
extends HTMLElementImpl
implements HTMLBaseElement
{
private static final long serialVersionUID = -396648580810072153L;
public String getHref()
{
return getAttribute( "href" );
}
public void setHref( String href )
{
setAttribute( "href", href );
}
public String getTarget()
{
return getAttribute( "target" );
}
public void setTarget( String target )
{
setAttribute( "target", target );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLBaseElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLBaseFontElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLBaseFontElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLBaseFontElementImpl
extends HTMLElementImpl
implements HTMLBaseFontElement
{
private static final long serialVersionUID = -3650249921091097229L;
public String getColor()
{
return capitalize( getAttribute( "color" ) );
}
public void setColor( String color )
{
setAttribute( "color", color );
}
public String getFace()
{
return capitalize( getAttribute( "face" ) );
}
public void setFace( String face )
{
setAttribute( "face", face );
}
public String getSize()
{
return getAttribute( "size" );
}
public void setSize( String size )
{
setAttribute( "size", size );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLBaseFontElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,119 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLBodyElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLBodyElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLBodyElementImpl
extends HTMLElementImpl
implements HTMLBodyElement
{
private static final long serialVersionUID = 9058852459426595202L;
public String getALink()
{
return getAttribute( "alink" );
}
public void setALink(String aLink)
{
setAttribute( "alink", aLink );
}
public String getBackground()
{
return getAttribute( "background" );
}
public void setBackground( String background )
{
setAttribute( "background", background );
}
public String getBgColor()
{
return getAttribute( "bgcolor" );
}
public void setBgColor(String bgColor)
{
setAttribute( "bgcolor", bgColor );
}
public String getLink()
{
return getAttribute( "link" );
}
public void setLink(String link)
{
setAttribute( "link", link );
}
public String getText()
{
return getAttribute( "text" );
}
public void setText(String text)
{
setAttribute( "text", text );
}
public String getVLink()
{
return getAttribute( "vlink" );
}
public void setVLink(String vLink)
{
setAttribute( "vlink", vLink );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLBodyElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,227 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.util.Vector;
import org.apache.xerces.dom.ElementImpl;
import org.apache.xerces.dom.ProcessingInstructionImpl;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLDocument;
import org.xml.sax.AttributeList;
import org.xml.sax.DocumentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
* This is a SAX document handler that is used to build an HTML document.
* It can build a document from any SAX parser, but is specifically tuned
* for working with the OpenXML HTML parser.
*
*
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@openxml.org">Assaf Arkin</a>
*/
public class HTMLBuilder
implements DocumentHandler
{
/**
* The document that is being built.
*/
protected HTMLDocumentImpl _document;
/**
* The current node in the document into which elements, text and
* other nodes will be inserted. This starts as the document itself
* and reflects each element that is currently being parsed.
*/
protected ElementImpl _current;
/**
* Applies only to whitespace appearing between element tags in element content,
* as per the SAX definition, and true by default.
*/
private boolean _ignoreWhitespace = true;
/**
* Indicates whether finished building a document. If so, can start building
* another document. Must be initially true to get the first document processed.
*/
private boolean _done = true;
/**
* The document is only created the same time as the document element, however, certain
* nodes may precede the document element (comment and PI), and they are accumulated
* in this vector.
*/
protected Vector _preRootNodes;
public void startDocument()
throws SAXException
{
if ( ! _done )
throw new SAXException( "HTM001 State error: startDocument fired twice on one builder." );
_document = null;
_done = false;
}
public void endDocument()
throws SAXException
{
if ( _document == null )
throw new SAXException( "HTM002 State error: document never started or missing document element." );
if ( _current != null )
throw new SAXException( "HTM003 State error: document ended before end of document element." );
_current = null;
_done = true;
}
public synchronized void startElement( String tagName, AttributeList attrList )
throws SAXException
{
ElementImpl elem;
int i;
if ( tagName == null )
throw new SAXException( "HTM004 Argument 'tagName' is null." );
// If this is the root element, this is the time to create a new document,
// because only know we know the document element name and namespace URI.
if ( _document == null )
{
// No need to create the element explicitly.
_document = new HTMLDocumentImpl();
elem = (ElementImpl) _document.getDocumentElement();
_current = elem;
if ( _current == null )
throw new SAXException( "HTM005 State error: Document.getDocumentElement returns null." );
// Insert nodes (comment and PI) that appear before the root element.
if ( _preRootNodes != null )
{
for ( i = _preRootNodes.size() ; i-- > 0 ; )
_document.insertBefore( (Node) _preRootNodes.elementAt( i ), elem );
_preRootNodes = null;
}
}
else
{
// This is a state error, indicates that document has been parsed in full,
// or that there are two root elements.
if ( _current == null )
throw new SAXException( "HTM006 State error: startElement called after end of document element." );
elem = (ElementImpl) _document.createElement( tagName );
_current.appendChild( elem );
_current = elem;
}
// Add the attributes (specified and not-specified) to this element.
if ( attrList != null )
{
for ( i = 0 ; i < attrList.getLength() ; ++ i )
elem.setAttribute( attrList.getName( i ), attrList.getValue( i ) );
}
}
public void endElement( String tagName )
throws SAXException
{
if ( _current == null )
throw new SAXException( "HTM007 State error: endElement called with no current node." );
if ( ! _current.getNodeName().equalsIgnoreCase( tagName ))
throw new SAXException( "HTM008 State error: mismatch in closing tag name " + tagName + "\n" + tagName);
// Move up to the parent element. When you reach the top (closing the root element).
// the parent is document and current is null.
if ( _current.getParentNode() == _current.getOwnerDocument() )
_current = null;
else
_current = (ElementImpl) _current.getParentNode();
}
public void characters( String text )
throws SAXException
{
if ( _current == null )
throw new SAXException( "HTM009 State error: character data found outside of root element." );
_current.appendChild( _document.createTextNode(text) );
}
public void characters( char[] text, int start, int length )
throws SAXException
{
if ( _current == null )
throw new SAXException( "HTM010 State error: character data found outside of root element." );
_current.appendChild( _document.createTextNode(new String(text, start, length)) );
}
public void ignorableWhitespace( char[] text, int start, int length )
throws SAXException
{
if ( ! _ignoreWhitespace )
_current.appendChild( _document.createTextNode(new String(text, start, length)) );
}
public void processingInstruction( String target, String instruction )
throws SAXException
{
// Processing instruction may appear before the document element (in fact, before the
// document has been created, or after the document element has been closed.
if ( _current == null && _document == null )
{
if ( _preRootNodes == null )
_preRootNodes = new Vector();
_preRootNodes.addElement( new ProcessingInstructionImpl( null, target, instruction ) );
}
else
if ( _current == null && _document != null )
_document.appendChild( _document.createProcessingInstruction(target, instruction) );
else
_current.appendChild( _document.createProcessingInstruction(target, instruction) );
}
public HTMLDocument getHTMLDocument()
{
return _document;
}
public void setDocumentLocator( Locator locator )
{
// ignored
}
}

View File

@ -0,0 +1,129 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLButtonElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLButtonElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLButtonElementImpl
extends HTMLElementImpl
implements HTMLButtonElement, HTMLFormControl
{
private static final long serialVersionUID = -753685852948076730L;
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public int getTabIndex()
{
try
{
return Integer.parseInt( getAttribute( "tabindex" ) );
}
catch ( NumberFormatException except )
{
return 0;
}
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getType()
{
return capitalize( getAttribute( "type" ) );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLButtonElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,536 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.io.Serializable;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLAnchorElement;
import org.w3c.dom.html.HTMLAppletElement;
import org.w3c.dom.html.HTMLAreaElement;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLFormElement;
import org.w3c.dom.html.HTMLImageElement;
import org.w3c.dom.html.HTMLObjectElement;
import org.w3c.dom.html.HTMLOptionElement;
import org.w3c.dom.html.HTMLTableCellElement;
import org.w3c.dom.html.HTMLTableRowElement;
import org.w3c.dom.html.HTMLTableSectionElement;
/**
* Implements {@link org.w3c.dom.html.HTMLCollection} to traverse any named
* elements on a {@link org.w3c.dom.html.HTMLDocument}. The elements type to
* look for is identified in the constructor by code. This collection is not
* optimized for traversing large trees.
* <p>
* The collection has to meet two requirements: it has to be live, and it has
* to traverse depth first and always return results in that order. As such,
* using an object container (such as {@link java.util.Vector}) is expensive on
* insert/remove operations. Instead, the collection has been implemented using
* three traversing functions. As a result, operations on large documents will
* result in traversal of the entire document tree and consume a considerable
* amount of time.
* <p>
* Note that synchronization on the traversed document cannot be achieved.
* The document itself cannot be locked, and locking each traversed node is
* likely to lead to a dead lock condition. Therefore, there is a chance of the
* document being changed as results are fetched; in all likelihood, the results
* might be out dated, but not erroneous.
*
* @xerces.internal
*
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLCollection
*/
class HTMLCollectionImpl
implements HTMLCollection, Serializable
{
private static final long serialVersionUID = 9112122196669185082L;
/**
* Request collection of all anchors in document: &lt;A&gt; elements that
* have a <code>name</code> attribute.
*/
static final short ANCHOR = 1;
/**
* Request collection of all forms in document: &lt;FORM&gt; elements.
*/
static final short FORM = 2;
/**
* Request collection of all images in document: &lt;IMG&gt; elements.
*/
static final short IMAGE = 3;
/**
* Request collection of all Applets in document: &lt;APPLET&gt; and
* &lt;OBJECT&gt; elements (&lt;OBJECT&gt; must contain an Applet).
*/
static final short APPLET = 4;
/**
* Request collection of all links in document: &lt;A&gt; and &lt;AREA&gt;
* elements (must have a <code>href</code> attribute).
*/
static final short LINK = 5;
/**
* Request collection of all options in selection: &lt;OPTION&gt; elements in
* &lt;SELECT&gt; or &lt;OPTGROUP&gt;.
*/
static final short OPTION = 6;
/**
* Request collection of all rows in table: &lt;TR&gt; elements in table or
* table section.
*/
static final short ROW = 7;
/**
* Request collection of all form elements: &lt;INPUT&gt;, &lt;BUTTON&gt;,
* &lt;SELECT&gt;, and &lt;TEXTAREA&gt; elements inside form &lt;FORM&gt;.
*/
static final short ELEMENT = 8;
/**
* Request collection of all areas in map: &lt;AREA&gt; element in &lt;MAP&gt;
* (non recursive).
*/
static final short AREA = -1;
/**
* Request collection of all table bodies in table: &lt;TBODY&gt; element in
* table &lt;TABLE&gt; (non recursive).
*/
static final short TBODY = -2;
/**
* Request collection of all cells in row: &lt;TD&gt; and &lt;TH&gt;
* elements in &lt;TR&gt; (non recursive).
*/
static final short CELL = -3;
/**
* Indicates what this collection is looking for. Holds one of the enumerated
* values and used by {@link #collectionMatch}. Set by the constructor and
* determine the collection's use for its life time.
*/
private short _lookingFor;
/**
* This is the top level element underneath which the collection exists.
*/
private Element _topLevel;
/**
* Construct a new collection that retrieves element of the specific type
* (<code>lookingFor</code>) from the specific document portion
* (<code>topLevel</code>).
*
* @param topLevel The element underneath which the collection exists
* @param lookingFor Code indicating what elements to look for
*/
HTMLCollectionImpl( HTMLElement topLevel, short lookingFor )
{
if ( topLevel == null )
throw new NullPointerException( "HTM011 Argument 'topLevel' is null." );
_topLevel = topLevel;
_lookingFor = lookingFor;
}
/**
* Returns the length of the collection. This method might traverse the
* entire document tree.
*
* @return Length of the collection
*/
public final int getLength()
{
// Call recursive function on top-level element.
return getLength( _topLevel );
}
/**
* Retrieves the indexed node from the collection. Nodes are numbered in
* tree order - depth-first traversal order. This method might traverse
* the entire document tree.
*
* @param index The index of the node to return
* @return The specified node or null if no such node found
*/
public final Node item( int index )
{
if ( index < 0 )
throw new IllegalArgumentException( "HTM012 Argument 'index' is negative." );
// Call recursive function on top-level element.
return item( _topLevel, new CollectionIndex( index ) );
}
/**
* Retrieves the named node from the collection. The name is matched case
* sensitive against the <TT>id</TT> attribute of each element in the
* collection, returning the first match. The tree is traversed in
* depth-first order. This method might traverse the entire document tree.
*
* @param name The name of the node to return
* @return The specified node or null if no such node found
*/
public final Node namedItem( String name )
{
if ( name == null )
throw new NullPointerException( "HTM013 Argument 'name' is null." );
// Call recursive function on top-level element.
return namedItem( _topLevel, name );
}
/**
* Recursive function returns the number of elements of a particular type
* that exist under the top level element. This is a recursive function
* and the top level element is passed along.
*
* @param topLevel Top level element from which to scan
* @return Number of elements
*/
private int getLength( Element topLevel )
{
int length;
Node node;
synchronized ( topLevel )
{
// Always count from zero and traverse all the childs of the
// current element in the order they appear.
length = 0;
node = topLevel.getFirstChild();
while ( node != null )
{
// If a particular node is an element (could be HTML or XML),
// do two things: if it's the one we're looking for, count
// another matched element; at any rate, traverse it's
// children as well.
if ( node instanceof Element )
{
if ( collectionMatch( (Element) node, null ) )
++ length;
else if ( recurse() )
length += getLength( (Element) node );
}
node = node.getNextSibling();
}
}
return length;
}
/**
* Recursive function returns the numbered element of a particular type
* that exist under the top level element. This is a recursive function
* and the top level element is passed along.
* <p>
* Note that this function must call itself with an index and get back both
* the element (if one was found) and the new index which is decremeneted
* for any like element found. Since integers are only passed by value,
* this function makes use of a separate class ({@link CollectionIndex})
* to hold that index.
*
* @param topLevel Top level element from which to scan
* @param index The index of the item to retreive
* @return Number of elements
* @see CollectionIndex
*/
private Node item( Element topLevel, CollectionIndex index )
{
Node node;
Node result;
synchronized ( topLevel )
{
// Traverse all the childs of the current element in the order
// they appear. Count from the index backwards until you reach
// matching element with an index of zero. Return that element.
node = topLevel.getFirstChild();
while ( node != null )
{
// If a particular node is an element (could be HTML or XML),
// do two things: if it's the one we're looking for, decrease
// the index and if zero, return this node; at any rate,
// traverse it's children as well.
if ( node instanceof Element )
{
if ( collectionMatch( (Element) node, null ) )
{
if ( index.isZero() )
return node;
index.decrement();
} else if ( recurse() )
{
result = item( (Element) node, index );
if ( result != null )
return result;
}
}
node = node.getNextSibling();
}
}
return null;
}
/**
* Recursive function returns an element of a particular type with the
* specified name (<TT>id</TT> attribute).
*
* @param topLevel Top level element from which to scan
* @param name The named element to look for
* @return The first named element found
*/
private Node namedItem( Element topLevel, String name )
{
Node node;
Node result;
synchronized ( topLevel )
{
// Traverse all the childs of the current element in the order
// they appear.
node = topLevel.getFirstChild();
while ( node != null )
{
// If a particular node is an element (could be HTML or XML),
// do two things: if it's the one we're looking for, and the
// name (id attribute) attribute is the one we're looking for,
// return this element; otherwise, traverse it's children.
if ( node instanceof Element )
{
if ( collectionMatch( (Element) node, name ) )
return node;
else if ( recurse() )
{
result = namedItem( (Element) node, name );
if ( result != null )
return result;
}
}
node = node.getNextSibling();
}
return node;
}
}
/**
* Returns true if scanning methods should iterate through the collection.
* When looking for elements in the document, recursing is needed to traverse
* the full document tree. When looking inside a specific element (e.g. for a
* cell inside a row), recursing can lead to erroneous results.
*
* @return True if methods should recurse to traverse entire tree
*/
protected boolean recurse()
{
return _lookingFor > 0;
}
/**
* Determines if current element matches based on what we're looking for.
* The element is passed along with an optional identifier name. If the
* element is the one we're looking for, return true. If the name is also
* specified, the name must match the <code>id</code> attribute
* (match <code>name</code> first for anchors).
*
* @param elem The current element
* @param name The identifier name or null
* @return The element matches what we're looking for
*/
protected boolean collectionMatch( Element elem, String name )
{
boolean match;
synchronized ( elem )
{
// Begin with no matching. Depending on what we're looking for,
// attempt to match based on the element type. This is the quickest
// way to match involving only a cast. Do the expensive string
// comparison later on.
match = false;
switch ( _lookingFor )
{
case ANCHOR:
// Anchor is an <A> element with a 'name' attribute. Otherwise, it's
// just a link.
match = ( elem instanceof HTMLAnchorElement ) &&
elem.getAttribute( "name" ).length() > 0;
break;
case FORM:
// Any <FORM> element.
match = ( elem instanceof HTMLFormElement );
break;
case IMAGE:
// Any <IMG> element. <OBJECT> elements with images are not returned.
match = ( elem instanceof HTMLImageElement );
break;
case APPLET:
// Any <APPLET> element, and any <OBJECT> element which represents an
// Applet. This is determined by 'codetype' attribute being
// 'application/java' or 'classid' attribute starting with 'java:'.
match = ( elem instanceof HTMLAppletElement ) ||
( elem instanceof HTMLObjectElement &&
( "application/java".equals( elem.getAttribute( "codetype" ) ) ||
elem.getAttribute( "classid" ).startsWith( "java:" ) ) );
break;
case ELEMENT:
// All form elements implement HTMLFormControl for easy identification.
match = ( elem instanceof HTMLFormControl );
break;
case LINK:
// Any <A> element, and any <AREA> elements with an 'href' attribute.
match = ( ( elem instanceof HTMLAnchorElement ||
elem instanceof HTMLAreaElement ) &&
elem.getAttribute( "href" ).length() > 0 );
break;
case AREA:
// Any <AREA> element.
match = ( elem instanceof HTMLAreaElement );
break;
case OPTION:
// Any <OPTION> element.
match = ( elem instanceof HTMLOptionElement );
break;
case ROW:
// Any <TR> element.
match = ( elem instanceof HTMLTableRowElement );
break;
case TBODY:
// Any <TBODY> element (one of three table section types).
match = ( elem instanceof HTMLTableSectionElement &&
elem.getTagName().equals( "TBODY" ) );
break;
case CELL:
// Any <TD> or <TH> element.
match = ( elem instanceof HTMLTableCellElement );
break;
}
// If element type was matched and a name was specified, must also match
// the name against either the 'id' or the 'name' attribute. The 'name'
// attribute is relevant only for <A> elements for backward compatibility.
if ( match && name != null )
{
// If an anchor and 'name' attribute matches, return true. Otherwise,
// try 'id' attribute.
if ( elem instanceof HTMLAnchorElement &&
name.equals( elem.getAttribute( "name" ) ) )
return true;
match = name.equals( elem.getAttribute( "id" ) );
}
}
return match;
}
}
/**
* {@link CollectionImpl#item} must traverse down the tree and decrement the
* index until it matches an element who's index is zero. Since integers are
* passed by value, this class servers to pass the index into each recursion
* by reference. It encompasses all the operations that need be performed on
* the index, although direct access is possible.
*
* @xerces.internal
*
* @see CollectionImpl#item
*/
class CollectionIndex
{
/**
* Returns the current index.
*
* @return Current index
*/
int getIndex()
{
return _index;
}
/**
* Decrements the index by one.
*/
void decrement()
{
-- _index;
}
/**
* Returns true if index is zero (or negative).
*
* @return True if index is zero
*/
boolean isZero()
{
return _index <= 0;
}
/**
* Constructs a new index with the specified initial value. The index will
* then be decremeneted until it reaches zero.
*
* @param index The initial value
*/
CollectionIndex( int index )
{
_index = index;
}
/**
* Holds the actual value that is passed by reference using this class.
*/
private int _index;
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLDListElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLDListElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLDListElementImpl
extends HTMLElementImpl
implements HTMLDListElement
{
private static final long serialVersionUID = -2130005642453038604L;
public boolean getCompact()
{
return getBinary( "compact" );
}
public void setCompact( boolean compact )
{
setAttribute( "compact", compact );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLDListElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,93 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.apache.xerces.dom.DOMImplementationImpl;
import org.w3c.dom.DOMException;
import org.w3c.dom.html.HTMLDOMImplementation;
import org.w3c.dom.html.HTMLDocument;
/**
* Provides number of methods for performing operations that are independent
* of any particular instance of the document object model. This class is
* unconstructable, the only way to obtain an instance of a DOM implementation
* is by calling the static method {@link #getDOMImplementation}.
*
* @xerces.internal
*
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.DOMImplementation
*/
public class HTMLDOMImplementationImpl
extends DOMImplementationImpl
implements HTMLDOMImplementation
{
/**
* Holds a reference to the single instance of the DOM implementation.
* Only one instance is required since this class is multiple entry.
*/
private static final HTMLDOMImplementation _instance = new HTMLDOMImplementationImpl();
/**
* Private constructor assures that an object of this class cannot
* be created. The only way to obtain an object is by calling {@link
* #getDOMImplementation}.
*/
private HTMLDOMImplementationImpl()
{
}
/**
* Create a new HTML document of the specified <TT>TITLE</TT> text.
*
* @param title The document title text
* @return New HTML document
*/
public final HTMLDocument createHTMLDocument( String title )
throws DOMException
{
HTMLDocument doc;
if ( title == null )
throw new NullPointerException( "HTM014 Argument 'title' is null." );
doc = new HTMLDocumentImpl();
doc.setTitle( title );
return doc;
}
/**
* Returns an instance of a {@link HTMLDOMImplementation} that can be
* used to perform operations that are not specific to a particular
* document instance, e.g. to create a new document.
*
* @return Reference to a valid DOM implementation
*/
public static HTMLDOMImplementation getHTMLDOMImplementation()
{
return _instance;
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLDirectoryElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLDirectoryElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLDirectoryElementImpl
extends HTMLElementImpl
implements HTMLDirectoryElement
{
private static final long serialVersionUID = -1010376135190194454L;
public boolean getCompact()
{
return getBinary( "compact" );
}
public void setCompact( boolean compact )
{
setAttribute( "compact", compact );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLDirectoryElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,58 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLDivElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLDivElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLDivElementImpl
extends HTMLElementImpl
implements HTMLDivElement
{
private static final long serialVersionUID = 2327098984177358833L;
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLDivElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,788 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.io.StringWriter;
import java.lang.reflect.Constructor;
import java.util.Hashtable;
import java.util.Locale;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.ElementImpl;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.UserDataHandler;
import org.w3c.dom.html.HTMLBodyElement;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLDocument;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLFrameSetElement;
import org.w3c.dom.html.HTMLHeadElement;
import org.w3c.dom.html.HTMLHtmlElement;
import org.w3c.dom.html.HTMLTitleElement;
/**
* Implements an HTML document. Provides access to the top level element in the
* document, its body and title.
* <P>
* Several methods create new nodes of all basic types (comment, text, element,
* etc.). These methods create new nodes but do not place them in the document
* tree. The nodes may be placed in the document tree using {@link
* org.w3c.dom.Node#appendChild} or {@link org.w3c.dom.Node#insertBefore}, or
* they may be placed in some other document tree.
* <P>
* Note: &lt;FRAMESET&gt; documents are not supported at the moment, neither
* are direct document writing ({@link #open}, {@link #write}) and HTTP attribute
* methods ({@link #getURL}, {@link #getCookie}).
*
* @xerces.internal
*
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLDocument
*/
public class HTMLDocumentImpl
extends DocumentImpl
implements HTMLDocument
{
private static final long serialVersionUID = 4285791750126227180L;
/**
* Holds <code>HTMLCollectionImpl</code> object with live collection of all
* anchors in document. This reference is on demand only once.
*/
private HTMLCollectionImpl _anchors;
/**
* Holds <code>HTMLCollectionImpl</code> object with live collection of all
* forms in document. This reference is on demand only once.
*/
private HTMLCollectionImpl _forms;
/**
* Holds <code>HTMLCollectionImpl</code> object with live collection of all
* images in document. This reference is on demand only once.
*/
private HTMLCollectionImpl _images;
/**
* Holds <code>HTMLCollectionImpl</code> object with live collection of all
* links in document. This reference is on demand only once.
*/
private HTMLCollectionImpl _links;
/**
* Holds <code>HTMLCollectionImpl</code> object with live collection of all
* applets in document. This reference is on demand only once.
*/
private HTMLCollectionImpl _applets;
/**
* Holds string writer used by direct manipulation operation ({@link #open}.
* {@link #write}, etc) to write new contents into the document and parse
* that text into a document tree.
*/
private StringWriter _writer;
/**
* Holds names and classes of HTML element types. When an element with a
* particular tag name is created, the matching {@link java.lang.Class}
* is used to create the element object. For example, &lt;A&gt; matches
* {@link HTMLAnchorElementImpl}. This static table is shared across all
* HTML documents.
*
* @see #createElement
*/
private static Hashtable _elementTypesHTML;
/**
* Signature used to locate constructor of HTML element classes. This
* static array is shared across all HTML documents.
*
* @see #createElement
*/
private static final Class[] _elemClassSigHTML =
new Class[] { HTMLDocumentImpl.class, String.class };
/**
*/
public HTMLDocumentImpl()
{
super();
populateElementTypes();
}
public synchronized Element getDocumentElement()
{
Node html;
Node child;
Node next;
// The document element is the top-level HTML element of the HTML
// document. Only this element should exist at the top level.
// If the HTML element is found, all other elements that might
// precede it are placed inside the HTML element.
html = getFirstChild();
while ( html != null )
{
if ( html instanceof HTMLHtmlElement )
{
// REVISIT: [Q] Why is this code even here? In fact, the
// original code is in error because it will
// try to move ALL nodes to be children of the
// HTML tag. This is not the intended behavior
// for comments and processing instructions
// outside the root element; it will throw a
// hierarchy request error exception for doctype
// nodes; *and* this code shouldn't even be
// needed because the parser should never build
// a document that contains more than a single
// root element, anyway! -Ac
/***
synchronized ( html )
{
child = getFirstChild();
while ( child != null && child != html )
{
next = child.getNextSibling();
html.appendChild( child );
child = next;
}
}
/***/
return (HTMLElement) html;
}
html = html.getNextSibling();
}
// HTML element must exist. Create a new element and dump the
// entire contents of the document into it in the same order as
// they appear now.
html = new HTMLHtmlElementImpl( this, "HTML" );
child = getFirstChild();
while ( child != null )
{
next = child.getNextSibling();
html.appendChild( child );
child = next;
}
appendChild( html );
return (HTMLElement) html;
}
/**
* Obtains the &lt;HEAD&gt; element in the document, creating one if does
* not exist before. The &lt;HEAD&gt; element is the first element in the
* &lt;HTML&gt; in the document. The &lt;HTML&gt; element is obtained by
* calling {@link #getDocumentElement}. If the element does not exist, one
* is created.
* <P>
* Called by {@link #getTitle}, {@link #setTitle}, {@link #getBody} and
* {@link #setBody} to assure the document has the &lt;HEAD&gt; element
* correctly placed.
*
* @return The &lt;HEAD&gt; element
*/
public synchronized HTMLElement getHead()
{
Node head;
Node html;
Node child;
Node next;
// Call getDocumentElement() to get the HTML element that is also the
// top-level element in the document. Get the first element in the
// document that is called HEAD. Work with that.
html = getDocumentElement();
synchronized ( html )
{
head = html.getFirstChild();
while ( head != null && ! ( head instanceof HTMLHeadElement ) )
head = head.getNextSibling();
// HEAD exists but might not be first element in HTML: make sure
// it is and return it.
if ( head != null )
{
synchronized ( head )
{
child = html.getFirstChild();
while ( child != null && child != head )
{
next = child.getNextSibling();
head.insertBefore( child, head.getFirstChild() );
child = next;
}
}
return (HTMLElement) head;
}
// Head does not exist, create a new one, place it at the top of the
// HTML element and return it.
head = new HTMLHeadElementImpl( this, "HEAD" );
html.insertBefore( head, html.getFirstChild() );
}
return (HTMLElement) head;
}
public synchronized String getTitle()
{
HTMLElement head;
NodeList list;
Node title;
// Get the HEAD element and look for the TITLE element within.
// When found, make sure the TITLE is a direct child of HEAD,
// and return the title's text (the Text node contained within).
head = getHead();
list = head.getElementsByTagName( "TITLE" );
if ( list.getLength() > 0 ) {
title = list.item( 0 );
return ( (HTMLTitleElement) title ).getText();
}
// No TITLE found, return an empty string.
return "";
}
public synchronized void setTitle( String newTitle )
{
HTMLElement head;
NodeList list;
Node title;
// Get the HEAD element and look for the TITLE element within.
// When found, make sure the TITLE is a direct child of HEAD,
// and set the title's text (the Text node contained within).
head = getHead();
list = head.getElementsByTagName( "TITLE" );
if ( list.getLength() > 0 ) {
title = list.item( 0 );
if ( title.getParentNode() != head )
head.appendChild( title );
( (HTMLTitleElement) title ).setText( newTitle );
}
else
{
// No TITLE found, create a new element and place it at the end
// of the HEAD element.
title = new HTMLTitleElementImpl( this, "TITLE" );
( (HTMLTitleElement) title ).setText( newTitle );
head.appendChild( title );
}
}
public synchronized HTMLElement getBody()
{
Node html;
Node head;
Node body;
Node child;
Node next;
// Call getDocumentElement() to get the HTML element that is also the
// top-level element in the document. Get the first element in the
// document that is called BODY. Work with that.
html = getDocumentElement();
head = getHead();
synchronized ( html )
{
body = head.getNextSibling();
while ( body != null && ! ( body instanceof HTMLBodyElement )
&& ! ( body instanceof HTMLFrameSetElement ) )
body = body.getNextSibling();
// BODY/FRAMESET exists but might not be second element in HTML
// (after HEAD): make sure it is and return it.
if ( body != null )
{
synchronized ( body )
{
child = head.getNextSibling();
while ( child != null && child != body )
{
next = child.getNextSibling();
body.insertBefore( child, body.getFirstChild() );
child = next;
}
}
return (HTMLElement) body;
}
// BODY does not exist, create a new one, place it in the HTML element
// right after the HEAD and return it.
body = new HTMLBodyElementImpl( this, "BODY" );
html.appendChild( body );
}
return (HTMLElement) body;
}
public synchronized void setBody( HTMLElement newBody )
{
Node html;
Node body;
Node head;
Node child;
NodeList list;
synchronized ( newBody )
{
// Call getDocumentElement() to get the HTML element that is also the
// top-level element in the document. Get the first element in the
// document that is called BODY. Work with that.
html = getDocumentElement();
head = getHead();
synchronized ( html )
{
list = this.getElementsByTagName( "BODY" );
if ( list.getLength() > 0 ) {
// BODY exists but might not follow HEAD in HTML. If not,
// make it so and replce it. Start with the HEAD and make
// sure the BODY is the first element after the HEAD.
body = list.item( 0 );
synchronized ( body )
{
child = head;
while ( child != null )
{
if ( child instanceof Element )
{
if ( child != body )
html.insertBefore( newBody, child );
else
html.replaceChild( newBody, body );
return;
}
child = child.getNextSibling();
}
html.appendChild( newBody );
}
return;
}
// BODY does not exist, place it in the HTML element
// right after the HEAD.
html.appendChild( newBody );
}
}
}
public synchronized Element getElementById( String elementId )
{
Element idElement = super.getElementById(elementId);
if (idElement != null) {
return idElement;
}
return getElementById( elementId, this );
}
public NodeList getElementsByName( String elementName )
{
return new NameNodeListImpl( this, elementName );
}
public final NodeList getElementsByTagName( String tagName )
{
return super.getElementsByTagName( tagName.toUpperCase(Locale.ENGLISH) );
}
public final NodeList getElementsByTagNameNS( String namespaceURI,
String localName )
{
if ( namespaceURI != null && namespaceURI.length() > 0 ) {
return super.getElementsByTagNameNS( namespaceURI, localName.toUpperCase(Locale.ENGLISH) );
}
return super.getElementsByTagName( localName.toUpperCase(Locale.ENGLISH) );
}
/**
* Xerces-specific constructor. "localName" is passed in, so we don't need
* to create a new String for it.
*
* @param namespaceURI The namespace URI of the element to
* create.
* @param qualifiedName The qualified name of the element type to
* instantiate.
* @param localpart The local name of the element to instantiate.
* @return Element A new Element object with the following attributes:
* @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified
* name contains an invalid character.
*/
public Element createElementNS(String namespaceURI, String qualifiedName,
String localpart)
throws DOMException
{
return createElementNS(namespaceURI, qualifiedName);
}
public Element createElementNS( String namespaceURI, String qualifiedName )
{
if ( namespaceURI == null || namespaceURI.length() == 0 ) {
return createElement( qualifiedName );
}
return super.createElementNS( namespaceURI, qualifiedName );
}
public Element createElement( String tagName )
throws DOMException
{
Class elemClass;
Constructor cnst;
// First, make sure tag name is all upper case, next get the associated
// element class. If no class is found, generate a generic HTML element.
// Do so also if an unexpected exception occurs.
tagName = tagName.toUpperCase(Locale.ENGLISH);
elemClass = (Class) _elementTypesHTML.get( tagName );
if ( elemClass != null )
{
// Get the constructor for the element. The signature specifies an
// owner document and a tag name. Use the constructor to instantiate
// a new object and return it.
try
{
cnst = elemClass.getConstructor( _elemClassSigHTML );
return (Element) cnst.newInstance( new Object[] { this, tagName } );
}
catch ( Exception except )
{
/*
Throwable thrw;
if ( except instanceof java.lang.reflect.InvocationTargetException )
thrw = ( (java.lang.reflect.InvocationTargetException) except ).getTargetException();
else
thrw = except;
System.out.println( "Exception " + thrw.getClass().getName() );
System.out.println( thrw.getMessage() );
*/
throw new IllegalStateException( "HTM15 Tag '" + tagName + "' associated with an Element class that failed to construct.\n" + tagName);
}
}
return new HTMLElementImpl( this, tagName );
}
/**
* Creates an Attribute having this Document as its OwnerDoc.
* Overrides {@link DocumentImpl#createAttribute} and returns
* and attribute whose name is lower case.
*
* @param name The name of the attribute
* @return An attribute whose name is all lower case
* @throws DOMException(INVALID_NAME_ERR) if the attribute name
* is not acceptable
*/
public Attr createAttribute( String name )
throws DOMException
{
return super.createAttribute( name.toLowerCase(Locale.ENGLISH) );
}
public String getReferrer()
{
// Information not available on server side.
return null;
}
public String getDomain()
{
// Information not available on server side.
return null;
}
public String getURL()
{
// Information not available on server side.
return null;
}
public String getCookie()
{
// Information not available on server side.
return null;
}
public void setCookie( String cookie )
{
// Information not available on server side.
}
public HTMLCollection getImages()
{
// For more information see HTMLCollection#collectionMatch
if ( _images == null )
_images = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.IMAGE );
return _images;
}
public HTMLCollection getApplets()
{
// For more information see HTMLCollection#collectionMatch
if ( _applets == null )
_applets = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.APPLET );
return _applets;
}
public HTMLCollection getLinks()
{
// For more information see HTMLCollection#collectionMatch
if ( _links == null )
_links = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.LINK );
return _links;
}
public HTMLCollection getForms()
{
// For more information see HTMLCollection#collectionMatch
if ( _forms == null )
_forms = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.FORM );
return _forms;
}
public HTMLCollection getAnchors()
{
// For more information see HTMLCollection#collectionMatch
if ( _anchors == null )
_anchors = new HTMLCollectionImpl( getBody(), HTMLCollectionImpl.ANCHOR );
return _anchors;
}
public void open()
{
// When called an in-memory is prepared. The document tree is still
// accessible the old way, until this writer is closed.
if ( _writer == null )
_writer = new StringWriter();
}
public void close()
{
// ! NOT IMPLEMENTED, REQUIRES PARSER !
if ( _writer != null )
{
_writer = null;
}
}
public void write( String text )
{
// Write a string into the in-memory writer.
if ( _writer != null )
_writer.write( text );
}
public void writeln( String text )
{
// Write a line into the in-memory writer.
if ( _writer != null )
_writer.write( text + "\n" );
}
public Node cloneNode( boolean deep )
{
HTMLDocumentImpl newdoc = new HTMLDocumentImpl();
callUserDataHandlers(this, newdoc, UserDataHandler.NODE_CLONED);
cloneNode(newdoc, deep);
return newdoc;
}
/* (non-Javadoc)
* @see CoreDocumentImpl#canRenameElements()
*/
protected boolean canRenameElements(String newNamespaceURI, String newNodeName, ElementImpl el) {
if (el.getNamespaceURI() != null) {
// element is not HTML:
// can be renamed if not changed to HTML
return newNamespaceURI != null;
}
// check whether a class change is required
Class newClass = (Class) _elementTypesHTML.get(newNodeName.toUpperCase(Locale.ENGLISH));
Class oldClass = (Class) _elementTypesHTML.get(el.getTagName());
return newClass == oldClass;
}
/**
* Recursive method retreives an element by its <code>id</code> attribute.
* Called by {@link #getElementById(String)}.
*
* @param elementId The <code>id</code> value to look for
* @return The node in which to look for
*/
private Element getElementById( String elementId, Node node )
{
Node child;
Element result;
child = node.getFirstChild();
while ( child != null )
{
if ( child instanceof Element )
{
if ( elementId.equals( ( (Element) child ).getAttribute( "id" ) ) )
return (Element) child;
result = getElementById( elementId, child );
if ( result != null )
return result;
}
child = child.getNextSibling();
}
return null;
}
/**
* Called by the constructor to populate the element types list (see {@link
* #_elementTypesHTML}). Will be called multiple times but populate the list
* only the first time. Replacement for static constructor.
*/
private synchronized static void populateElementTypes()
{
// This class looks like it is due to some strange
// (read: inconsistent) JVM bugs.
// Initially all this code was placed in the static constructor,
// but that caused some early JVMs (1.1) to go mad, and if a
// class could not be found (as happened during development),
// the JVM would die.
// Bertrand Delacretaz <bdelacretaz@worldcom.ch> pointed out
// several configurations where HTMLAnchorElementImpl.class
// failed, forcing me to revert back to Class.forName().
if ( _elementTypesHTML != null )
return;
_elementTypesHTML = new Hashtable( 63 );
populateElementType( "A", "HTMLAnchorElementImpl" );
populateElementType( "APPLET", "HTMLAppletElementImpl" );
populateElementType( "AREA", "HTMLAreaElementImpl" );
populateElementType( "BASE", "HTMLBaseElementImpl" );
populateElementType( "BASEFONT", "HTMLBaseFontElementImpl" );
populateElementType( "BLOCKQUOTE", "HTMLQuoteElementImpl" );
populateElementType( "BODY", "HTMLBodyElementImpl" );
populateElementType( "BR", "HTMLBRElementImpl" );
populateElementType( "BUTTON", "HTMLButtonElementImpl" );
populateElementType( "DEL", "HTMLModElementImpl" );
populateElementType( "DIR", "HTMLDirectoryElementImpl" );
populateElementType( "DIV", "HTMLDivElementImpl" );
populateElementType( "DL", "HTMLDListElementImpl" );
populateElementType( "FIELDSET", "HTMLFieldSetElementImpl" );
populateElementType( "FONT", "HTMLFontElementImpl" );
populateElementType( "FORM", "HTMLFormElementImpl" );
populateElementType( "FRAME","HTMLFrameElementImpl" );
populateElementType( "FRAMESET", "HTMLFrameSetElementImpl" );
populateElementType( "HEAD", "HTMLHeadElementImpl" );
populateElementType( "H1", "HTMLHeadingElementImpl" );
populateElementType( "H2", "HTMLHeadingElementImpl" );
populateElementType( "H3", "HTMLHeadingElementImpl" );
populateElementType( "H4", "HTMLHeadingElementImpl" );
populateElementType( "H5", "HTMLHeadingElementImpl" );
populateElementType( "H6", "HTMLHeadingElementImpl" );
populateElementType( "HR", "HTMLHRElementImpl" );
populateElementType( "HTML", "HTMLHtmlElementImpl" );
populateElementType( "IFRAME", "HTMLIFrameElementImpl" );
populateElementType( "IMG", "HTMLImageElementImpl" );
populateElementType( "INPUT", "HTMLInputElementImpl" );
populateElementType( "INS", "HTMLModElementImpl" );
populateElementType( "ISINDEX", "HTMLIsIndexElementImpl" );
populateElementType( "LABEL", "HTMLLabelElementImpl" );
populateElementType( "LEGEND", "HTMLLegendElementImpl" );
populateElementType( "LI", "HTMLLIElementImpl" );
populateElementType( "LINK", "HTMLLinkElementImpl" );
populateElementType( "MAP", "HTMLMapElementImpl" );
populateElementType( "MENU", "HTMLMenuElementImpl" );
populateElementType( "META", "HTMLMetaElementImpl" );
populateElementType( "OBJECT", "HTMLObjectElementImpl" );
populateElementType( "OL", "HTMLOListElementImpl" );
populateElementType( "OPTGROUP", "HTMLOptGroupElementImpl" );
populateElementType( "OPTION", "HTMLOptionElementImpl" );
populateElementType( "P", "HTMLParagraphElementImpl" );
populateElementType( "PARAM", "HTMLParamElementImpl" );
populateElementType( "PRE", "HTMLPreElementImpl" );
populateElementType( "Q", "HTMLQuoteElementImpl" );
populateElementType( "SCRIPT", "HTMLScriptElementImpl" );
populateElementType( "SELECT", "HTMLSelectElementImpl" );
populateElementType( "STYLE", "HTMLStyleElementImpl" );
populateElementType( "TABLE", "HTMLTableElementImpl" );
populateElementType( "CAPTION", "HTMLTableCaptionElementImpl" );
populateElementType( "TD", "HTMLTableCellElementImpl" );
populateElementType( "TH", "HTMLTableCellElementImpl" );
populateElementType( "COL", "HTMLTableColElementImpl" );
populateElementType( "COLGROUP", "HTMLTableColElementImpl" );
populateElementType( "TR", "HTMLTableRowElementImpl" );
populateElementType( "TBODY", "HTMLTableSectionElementImpl" );
populateElementType( "THEAD", "HTMLTableSectionElementImpl" );
populateElementType( "TFOOT", "HTMLTableSectionElementImpl" );
populateElementType( "TEXTAREA", "HTMLTextAreaElementImpl" );
populateElementType( "TITLE", "HTMLTitleElementImpl" );
populateElementType( "UL", "HTMLUListElementImpl" );
}
private static void populateElementType( String tagName, String className )
{
try {
_elementTypesHTML.put( tagName,
ObjectFactory.findProviderClass("org.apache.html.dom." + className,
HTMLDocumentImpl.class.getClassLoader(), true) );
} catch ( Exception except ) {
throw new RuntimeException( "HTM019 OpenXML Error: Could not find or execute class " + className + " implementing HTML element " + tagName
+ "\n" + className + "\t" + tagName);
}
}
}

View File

@ -0,0 +1,257 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.util.Locale;
import org.apache.xerces.dom.ElementImpl;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLFormElement;
/**
* Implements an HTML-specific element, an {@link org.w3c.dom.Element} that
* will only appear inside HTML documents. This element extends {@link
* org.apache.xerces.dom.ElementImpl} by adding methods for directly
* manipulating HTML-specific attributes. All HTML elements gain access to
* the <code>id</code>, <code>title</code>, <code>lang</code>,
* <code>dir</code> and <code>class</code> attributes. Other elements
* add their own specific attributes.
*
* @xerces.internal
*
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLElement
*/
public class HTMLElementImpl
extends ElementImpl
implements HTMLElement
{
private static final long serialVersionUID = 5283925246324423495L;
/**
* Constructor required owner document and element tag name. Will be called
* by the constructor of specific element types but with a known tag name.
* Assures that the owner document is an HTML element.
*
* @param owner The owner HTML document
* @param tagName The element's tag name
*/
public HTMLElementImpl( HTMLDocumentImpl owner, String tagName ) {
super( owner, tagName.toUpperCase(Locale.ENGLISH) );
}
public String getId() {
return getAttribute( "id" );
}
public void setId( String id ) {
setAttribute( "id", id );
}
public String getTitle() {
return getAttribute( "title" );
}
public void setTitle( String title ) {
setAttribute( "title", title );
}
public String getLang() {
return getAttribute( "lang" );
}
public void setLang( String lang ) {
setAttribute( "lang", lang );
}
public String getDir() {
return getAttribute( "dir" );
}
public void setDir( String dir ) {
setAttribute( "dir", dir );
}
public String getClassName() {
return getAttribute( "class" );
}
public void setClassName( String className ) {
setAttribute( "class", className );
}
/**
* Convenience method used to translate an attribute value into an integer
* value. Returns the integer value or zero if the attribute is not a
* valid numeric string.
*
* @param value The value of the attribute
* @return The integer value, or zero if not a valid numeric string
*/
int getInteger( String value ) {
try {
return Integer.parseInt( value );
}
catch ( NumberFormatException except ) {
return 0;
}
}
/**
* Convenience method used to translate an attribute value into a boolean
* value. If the attribute has an associated value (even an empty string),
* it is set and true is returned. If the attribute does not exist, false
* is returend.
*
* @param value The value of the attribute
* @return True or false depending on whether the attribute has been set
*/
boolean getBinary( String name ) {
return ( getAttributeNode( name ) != null );
}
/**
* Convenience method used to set a boolean attribute. If the value is true,
* the attribute is set to an empty string. If the value is false, the attribute
* is removed. HTML 4.0 understands empty strings as set attributes.
*
* @param name The name of the attribute
* @param value The value of the attribute
*/
void setAttribute( String name, boolean value ) {
if ( value ) {
setAttribute( name, name );
}
else {
removeAttribute( name );
}
}
public Attr getAttributeNode( String attrName ) {
return super.getAttributeNode( attrName.toLowerCase(Locale.ENGLISH) );
}
public Attr getAttributeNodeNS( String namespaceURI,
String localName ) {
if ( namespaceURI != null && namespaceURI.length() > 0 ) {
return super.getAttributeNodeNS( namespaceURI, localName );
}
return super.getAttributeNode( localName.toLowerCase(Locale.ENGLISH) );
}
public String getAttribute( String attrName ) {
return super.getAttribute( attrName.toLowerCase(Locale.ENGLISH) );
}
public String getAttributeNS( String namespaceURI,
String localName ) {
if ( namespaceURI != null && namespaceURI.length() > 0 ) {
return super.getAttributeNS( namespaceURI, localName );
}
return super.getAttribute( localName.toLowerCase(Locale.ENGLISH) );
}
public final NodeList getElementsByTagName( String tagName ) {
return super.getElementsByTagName( tagName.toUpperCase(Locale.ENGLISH) );
}
public final NodeList getElementsByTagNameNS( String namespaceURI,
String localName ) {
if ( namespaceURI != null && namespaceURI.length() > 0 ) {
return super.getElementsByTagNameNS( namespaceURI, localName.toUpperCase(Locale.ENGLISH) );
}
return super.getElementsByTagName( localName.toUpperCase(Locale.ENGLISH) );
}
/**
* Convenience method used to capitalize a one-off attribute value before it
* is returned. For example, the align values "LEFT" and "left" will both
* return as "Left".
*
* @param value The value of the attribute
* @return The capitalized value
*/
String capitalize( String value ) {
char[] chars;
int i;
// Convert string to charactares. Convert the first one to upper case,
// the other characters to lower case, and return the converted string.
chars = value.toCharArray();
if ( chars.length > 0 ) {
chars[ 0 ] = Character.toUpperCase( chars[ 0 ] );
for ( i = 1 ; i < chars.length ; ++i ) {
chars[ i ] = Character.toLowerCase( chars[ i ] );
}
return String.valueOf( chars );
}
return value;
}
/**
* Convenience method used to capitalize a one-off attribute value before it
* is returned. For example, the align values "LEFT" and "left" will both
* return as "Left".
*
* @param name The name of the attribute
* @return The capitalized value
*/
String getCapitalized( String name ) {
String value;
char[] chars;
int i;
value = getAttribute( name );
if ( value != null ) {
// Convert string to charactares. Convert the first one to upper case,
// the other characters to lower case, and return the converted string.
chars = value.toCharArray();
if ( chars.length > 0 ) {
chars[ 0 ] = Character.toUpperCase( chars[ 0 ] );
for ( i = 1 ; i < chars.length ; ++i ) {
chars[ i ] = Character.toLowerCase( chars[ i ] );
}
return String.valueOf( chars );
}
}
return value;
}
/**
* Convenience method returns the form in which this form element is contained.
* This method is exposed for form elements through the DOM API, but other
* elements have no access to it through the API.
*/
public HTMLFormElement getForm() {
Node parent = getParentNode();
while ( parent != null ) {
if ( parent instanceof HTMLFormElement ) {
return (HTMLFormElement) parent;
}
parent = parent.getParentNode();
}
return null;
}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLFieldSetElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLFieldSetElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLFieldSetElementImpl
extends HTMLElementImpl
implements HTMLFieldSetElement, HTMLFormControl
{
private static final long serialVersionUID = 1146145578073441343L;
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLFieldSetElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLFontElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLFontElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLFontElementImpl
extends HTMLElementImpl
implements HTMLFontElement
{
private static final long serialVersionUID = -415914342045846318L;
public String getColor()
{
return capitalize( getAttribute( "color" ) );
}
public void setColor( String color )
{
setAttribute( "color", color );
}
public String getFace()
{
return capitalize( getAttribute( "face" ) );
}
public void setFace( String face )
{
setAttribute( "face", face );
}
public String getSize()
{
return getAttribute( "size" );
}
public void setSize( String size )
{
setAttribute( "size", size );
}
public HTMLFontElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
/**
* Identifies control in a form, so they may be collected in a form elements
* collection. All form control elements implement this empty interface.
*
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
*/
public interface HTMLFormControl
{
}

View File

@ -0,0 +1,170 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLFormElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLFormElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLFormElementImpl
extends HTMLElementImpl
implements HTMLFormElement
{
private static final long serialVersionUID = -7324749629151493210L;
public HTMLCollection getElements()
{
if ( _elements == null )
_elements = new HTMLCollectionImpl( this, HTMLCollectionImpl.ELEMENT );
return _elements;
}
public int getLength()
{
return getElements().getLength();
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getAcceptCharset()
{
return getAttribute( "accept-charset" );
}
public void setAcceptCharset( String acceptCharset )
{
setAttribute( "accept-charset", acceptCharset );
}
public String getAction()
{
return getAttribute( "action" );
}
public void setAction( String action )
{
setAttribute( "action", action );
}
public String getEnctype()
{
return getAttribute( "enctype" );
}
public void setEnctype( String enctype )
{
setAttribute( "enctype", enctype );
}
public String getMethod()
{
return capitalize( getAttribute( "method" ) );
}
public void setMethod( String method )
{
setAttribute( "method", method );
}
public String getTarget()
{
return getAttribute( "target" );
}
public void setTarget( String target )
{
setAttribute( "target", target );
}
public void submit()
{
// No scripting in server-side DOM. This method is moot.
}
public void reset()
{
// No scripting in server-side DOM. This method is moot.
}
/*
* Explicit implementation of getChildNodes() to avoid problems with
* overriding the getLength() method hidden in the super class.
*/
public NodeList getChildNodes() {
return getChildNodesUnoptimized();
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getElements() gets cleared.
*/
public Node cloneNode( boolean deep ) {
HTMLFormElementImpl clonedNode = (HTMLFormElementImpl)super.cloneNode( deep );
clonedNode._elements = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLFormElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
/**
* Collection of all elements contained in this FORM.
*/
private HTMLCollectionImpl _elements;
}

View File

@ -0,0 +1,143 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLFrameElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLFrameElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLFrameElementImpl
extends HTMLElementImpl
implements HTMLFrameElement
{
private static final long serialVersionUID = 635237057173695984L;
public String getFrameBorder()
{
return getAttribute( "frameborder" );
}
public void setFrameBorder( String frameBorder )
{
setAttribute( "frameborder", frameBorder );
}
public String getLongDesc()
{
return getAttribute( "longdesc" );
}
public void setLongDesc( String longDesc )
{
setAttribute( "longdesc", longDesc );
}
public String getMarginHeight()
{
return getAttribute( "marginheight" );
}
public void setMarginHeight( String marginHeight )
{
setAttribute( "marginheight", marginHeight );
}
public String getMarginWidth()
{
return getAttribute( "marginwidth" );
}
public void setMarginWidth( String marginWidth )
{
setAttribute( "marginwidth", marginWidth );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public boolean getNoResize()
{
return getBinary( "noresize" );
}
public void setNoResize( boolean noResize )
{
setAttribute( "noresize", noResize );
}
public String getScrolling()
{
return capitalize( getAttribute( "scrolling" ) );
}
public void setScrolling( String scrolling )
{
setAttribute( "scrolling", scrolling );
}
public String getSrc()
{
return getAttribute( "src" );
}
public void setSrc( String src )
{
setAttribute( "src", src );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLFrameElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLFrameSetElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLFrameSetElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLFrameSetElementImpl
extends HTMLElementImpl
implements HTMLFrameSetElement
{
private static final long serialVersionUID = 8403143821972586708L;
public String getCols()
{
return getAttribute( "cols" );
}
public void setCols( String cols )
{
setAttribute( "cols", cols );
}
public String getRows()
{
return getAttribute( "rows" );
}
public void setRows( String rows )
{
setAttribute( "rows", rows );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLFrameSetElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,95 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLHRElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLHRElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLHRElementImpl
extends HTMLElementImpl
implements HTMLHRElement
{
private static final long serialVersionUID = -4210053417678939270L;
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public boolean getNoShade()
{
return getBinary( "noshade" );
}
public void setNoShade( boolean noShade )
{
setAttribute( "noshade", noShade );
}
public String getSize()
{
return getAttribute( "size" );
}
public void setSize( String size )
{
setAttribute( "size", size );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLHRElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLHeadElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLHeadElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLHeadElementImpl
extends HTMLElementImpl
implements HTMLHeadElement
{
private static final long serialVersionUID = 6438668473721292232L;
public String getProfile()
{
return getAttribute( "profile" );
}
public void setProfile( String profile )
{
setAttribute( "profile", profile );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLHeadElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLHeadingElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLHeadingElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLHeadingElementImpl
extends HTMLElementImpl
implements HTMLHeadingElement
{
private static final long serialVersionUID = 6605827989383069095L;
public String getAlign()
{
return getCapitalized( "align" );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLHeadingElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLHtmlElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLHtmlElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLHtmlElementImpl
extends HTMLElementImpl
implements HTMLHtmlElement
{
private static final long serialVersionUID = -4489734201536616166L;
public String getVersion()
{
return capitalize( getAttribute( "version" ) );
}
public void setVersion( String version )
{
setAttribute( "version", version );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLHtmlElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,166 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLIFrameElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLIFrameElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLIFrameElementImpl
extends HTMLElementImpl
implements HTMLIFrameElement
{
private static final long serialVersionUID = 2393622754706230429L;
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getFrameBorder()
{
return getAttribute( "frameborder" );
}
public void setFrameBorder( String frameBorder )
{
setAttribute( "frameborder", frameBorder );
}
public String getHeight()
{
return getAttribute( "height" );
}
public void setHeight( String height )
{
setAttribute( "height", height );
}
public String getLongDesc()
{
return getAttribute( "longdesc" );
}
public void setLongDesc( String longDesc )
{
setAttribute( "longdesc", longDesc );
}
public String getMarginHeight()
{
return getAttribute( "marginheight" );
}
public void setMarginHeight( String marginHeight )
{
setAttribute( "marginheight", marginHeight );
}
public String getMarginWidth()
{
return getAttribute( "marginwidth" );
}
public void setMarginWidth( String marginWidth )
{
setAttribute( "marginwidth", marginWidth );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getScrolling()
{
return capitalize( getAttribute( "scrolling" ) );
}
public void setScrolling( String scrolling )
{
setAttribute( "scrolling", scrolling );
}
public String getSrc()
{
return getAttribute( "src" );
}
public void setSrc( String src )
{
setAttribute( "src", src );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLIFrameElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,203 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLImageElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLImageElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLImageElementImpl
extends HTMLElementImpl
implements HTMLImageElement
{
private static final long serialVersionUID = 1424360710977241315L;
public String getLowSrc()
{
return getAttribute( "lowsrc" );
}
public void setLowSrc( String lowSrc )
{
setAttribute( "lowsrc", lowSrc );
}
public String getSrc()
{
return getAttribute( "src" );
}
public void setSrc( String src )
{
setAttribute( "src", src );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getAlt()
{
return getAttribute( "alt" );
}
public void setAlt( String alt )
{
setAttribute( "alt", alt );
}
public String getBorder()
{
return getAttribute( "border" );
}
public void setBorder( String border )
{
setAttribute( "border", border );
}
public String getHeight()
{
return getAttribute( "height" );
}
public void setHeight( String height )
{
setAttribute( "height", height );
}
public String getHspace()
{
return getAttribute( "hspace" );
}
public void setHspace( String hspace )
{
setAttribute( "hspace", hspace );
}
public boolean getIsMap()
{
return getBinary( "ismap" );
}
public void setIsMap( boolean isMap )
{
setAttribute( "ismap", isMap );
}
public String getLongDesc()
{
return getAttribute( "longdesc" );
}
public void setLongDesc( String longDesc )
{
setAttribute( "longdesc", longDesc );
}
public String getUseMap()
{
return getAttribute( "useMap" );
}
public void setUseMap( String useMap )
{
setAttribute( "useMap", useMap );
}
public String getVspace()
{
return getAttribute( "vspace" );
}
public void setVspace( String vspace )
{
setAttribute( "vspace", vspace );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLImageElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,290 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLInputElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLInputElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLInputElementImpl
extends HTMLElementImpl
implements HTMLInputElement, HTMLFormControl
{
private static final long serialVersionUID = 640139325394332007L;
public String getDefaultValue()
{
// ! NOT FULLY IMPLEMENTED !
return getAttribute( "defaultValue" );
}
public void setDefaultValue( String defaultValue )
{
// ! NOT FULLY IMPLEMENTED !
setAttribute( "defaultValue", defaultValue );
}
public boolean getDefaultChecked()
{
// ! NOT FULLY IMPLEMENTED !
return getBinary( "defaultChecked" );
}
public void setDefaultChecked( boolean defaultChecked )
{
// ! NOT FULLY IMPLEMENTED !
setAttribute( "defaultChecked", defaultChecked );
}
public String getAccept()
{
return getAttribute( "accept" );
}
public void setAccept( String accept )
{
setAttribute( "accept", accept );
}
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getAlt()
{
return getAttribute( "alt" );
}
public void setAlt( String alt )
{
setAttribute( "alt", alt );
}
public boolean getChecked()
{
return getBinary( "checked" );
}
public void setChecked( boolean checked )
{
setAttribute( "checked", checked );
}
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public int getMaxLength()
{
return getInteger( getAttribute( "maxlength" ) );
}
public void setMaxLength( int maxLength )
{
setAttribute( "maxlength", String.valueOf( maxLength ) );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public boolean getReadOnly()
{
return getBinary( "readonly" );
}
public void setReadOnly( boolean readOnly )
{
setAttribute( "readonly", readOnly );
}
public String getSize()
{
return getAttribute( "size" );
}
public void setSize( String size )
{
setAttribute( "size", size );
}
public String getSrc()
{
return getAttribute( "src" );
}
public void setSrc( String src )
{
setAttribute( "src", src );
}
public int getTabIndex()
{
try
{
return Integer.parseInt( getAttribute( "tabindex" ) );
}
catch ( NumberFormatException except )
{
return 0;
}
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getType()
{
return getAttribute( "type" );
}
public String getUseMap()
{
return getAttribute( "useMap" );
}
public void setUseMap( String useMap )
{
setAttribute( "useMap", useMap );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
public void blur()
{
// No scripting in server-side DOM. This method is moot.
}
public void focus()
{
// No scripting in server-side DOM. This method is moot.
}
public void select()
{
// No scripting in server-side DOM. This method is moot.
}
public void click()
{
// No scripting in server-side DOM. This method is moot.
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLInputElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLIsIndexElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLIsIndexElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLIsIndexElementImpl
extends HTMLElementImpl
implements HTMLIsIndexElement
{
private static final long serialVersionUID = 3073521742049689699L;
public String getPrompt()
{
return getAttribute( "prompt" );
}
public void setPrompt( String prompt )
{
setAttribute( "prompt", prompt );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLIsIndexElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLLIElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLLIElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLLIElementImpl
extends HTMLElementImpl
implements HTMLLIElement
{
private static final long serialVersionUID = -8987309345926701831L;
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
public int getValue()
{
return getInteger( getAttribute( "value" ) );
}
public void setValue( int value )
{
setAttribute( "value", String.valueOf( value ) );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLLIElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLLabelElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLLabelElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLLabelElementImpl
extends HTMLElementImpl
implements HTMLLabelElement, HTMLFormControl
{
private static final long serialVersionUID = 5774388295313199380L;
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public String getHtmlFor()
{
return getAttribute( "for" );
}
public void setHtmlFor( String htmlFor )
{
setAttribute( "for", htmlFor );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLLabelElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLLegendElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLLegendElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLLegendElementImpl
extends HTMLElementImpl
implements HTMLLegendElement
{
private static final long serialVersionUID = -621849164029630762L;
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public String getAlign()
{
return getAttribute( "align" );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLLegendElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,155 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLLinkElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLLinkElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLLinkElementImpl
extends HTMLElementImpl
implements HTMLLinkElement
{
private static final long serialVersionUID = 874345520063418879L;
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getCharset()
{
return getAttribute( "charset" );
}
public void setCharset( String charset )
{
setAttribute( "charset", charset );
}
public String getHref()
{
return getAttribute( "href" );
}
public void setHref( String href )
{
setAttribute( "href", href );
}
public String getHreflang()
{
return getAttribute( "hreflang" );
}
public void setHreflang( String hreflang )
{
setAttribute( "hreflang", hreflang );
}
public String getMedia()
{
return getAttribute( "media" );
}
public void setMedia( String media )
{
setAttribute( "media", media );
}
public String getRel()
{
return getAttribute( "rel" );
}
public void setRel( String rel )
{
setAttribute( "rel", rel );
}
public String getRev()
{
return getAttribute( "rev" );
}
public void setRev( String rev )
{
setAttribute( "rev", rev );
}
public String getTarget()
{
return getAttribute( "target" );
}
public void setTarget( String target )
{
setAttribute( "target", target );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLLinkElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,82 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLMapElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLMapElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLMapElementImpl
extends HTMLElementImpl
implements HTMLMapElement
{
private static final long serialVersionUID = 7520887584251976392L;
public HTMLCollection getAreas()
{
if ( _areas == null )
_areas = new HTMLCollectionImpl( this, HTMLCollectionImpl.AREA );
return _areas;
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getAreas() gets cleared.
*/
public Node cloneNode( boolean deep )
{
HTMLMapElementImpl clonedNode = (HTMLMapElementImpl)super.cloneNode( deep );
clonedNode._areas = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLMapElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
private HTMLCollection _areas;
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLMenuElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLMenuElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLMenuElementImpl
extends HTMLElementImpl
implements HTMLMenuElement
{
private static final long serialVersionUID = -1489696654903916901L;
public boolean getCompact()
{
return getBinary( "compact" );
}
public void setCompact( boolean compact )
{
setAttribute( "compact", compact );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLMenuElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,96 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLMetaElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLMetaElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLMetaElementImpl
extends HTMLElementImpl
implements HTMLMetaElement
{
private static final long serialVersionUID = -2401961905874264272L;
public String getContent()
{
return getAttribute( "content" );
}
public void setContent( String content )
{
setAttribute( "content", content );
}
public String getHttpEquiv()
{
return getAttribute( "http-equiv" );
}
public void setHttpEquiv( String httpEquiv )
{
setAttribute( "http-equiv", httpEquiv );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getScheme()
{
return getAttribute( "scheme" );
}
public void setScheme( String scheme )
{
setAttribute( "scheme", scheme );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLMetaElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLModElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLModElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLModElementImpl
extends HTMLElementImpl
implements HTMLModElement
{
private static final long serialVersionUID = 6424581972706750120L;
public String getCite()
{
return getAttribute( "cite" );
}
public void setCite( String cite )
{
setAttribute( "cite", cite );
}
public String getDateTime()
{
return getAttribute( "datetime" );
}
public void setDateTime( String dateTime )
{
setAttribute( "datetime", dateTime );
}
/**
* Constructor requires owner document and tag name.
*
* @param owner The owner HTML document
*/
public HTMLModElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLOListElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLOListElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLOListElementImpl
extends HTMLElementImpl
implements HTMLOListElement
{
private static final long serialVersionUID = 1293750546025862146L;
public boolean getCompact()
{
return getBinary( "compact" );
}
public void setCompact( boolean compact )
{
setAttribute( "compact", compact );
}
public int getStart()
{
return getInteger( getAttribute( "start" ) );
}
public void setStart( int start )
{
setAttribute( "start", String.valueOf( start ) );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLOListElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,256 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLObjectElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLObjectElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLObjectElementImpl
extends HTMLElementImpl
implements HTMLObjectElement, HTMLFormControl
{
private static final long serialVersionUID = 2276953229932965067L;
public String getCode()
{
return getAttribute( "code" );
}
public void setCode( String code )
{
setAttribute( "code", code );
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getArchive()
{
return getAttribute( "archive" );
}
public void setArchive( String archive )
{
setAttribute( "archive", archive );
}
public String getBorder()
{
return getAttribute( "border" );
}
public void setBorder( String border )
{
setAttribute( "border", border );
}
public String getCodeBase()
{
return getAttribute( "codebase" );
}
public void setCodeBase( String codeBase )
{
setAttribute( "codebase", codeBase );
}
public String getCodeType()
{
return getAttribute( "codetype" );
}
public void setCodeType( String codeType )
{
setAttribute( "codetype", codeType );
}
public String getData()
{
return getAttribute( "data" );
}
public void setData( String data )
{
setAttribute( "data", data );
}
public boolean getDeclare()
{
return getBinary( "declare" );
}
public void setDeclare( boolean declare )
{
setAttribute( "declare", declare );
}
public String getHeight()
{
return getAttribute( "height" );
}
public void setHeight( String height )
{
setAttribute( "height", height );
}
public String getHspace()
{
return getAttribute( "hspace" );
}
public void setHspace( String hspace )
{
setAttribute( "hspace", hspace );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getStandby()
{
return getAttribute( "standby" );
}
public void setStandby( String standby )
{
setAttribute( "standby", standby );
}
public int getTabIndex()
{
try
{
return Integer.parseInt( getAttribute( "tabindex" ) );
}
catch ( NumberFormatException except )
{
return 0;
}
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
public String getUseMap()
{
return getAttribute( "useMap" );
}
public void setUseMap( String useMap )
{
setAttribute( "useMap", useMap );
}
public String getVspace()
{
return getAttribute( "vspace" );
}
public void setVspace( String vspace )
{
setAttribute( "vspace", vspace );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLObjectElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLOptGroupElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLOptGroupElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLOptGroupElementImpl
extends HTMLElementImpl
implements HTMLOptGroupElement
{
private static final long serialVersionUID = -8807098641226171501L;
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getLabel()
{
return capitalize( getAttribute( "label" ) );
}
public void setLabel( String label )
{
setAttribute( "label", label );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLOptGroupElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,209 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLOptionElement;
import org.w3c.dom.html.HTMLSelectElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@openxml.org">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLOptionElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLOptionElementImpl
extends HTMLElementImpl
implements HTMLOptionElement
{
private static final long serialVersionUID = -4486774554137530907L;
public boolean getDefaultSelected()
{
// ! NOT FULLY IMPLEMENTED !
return getBinary( "default-selected" );
}
public void setDefaultSelected( boolean defaultSelected )
{
// ! NOT FULLY IMPLEMENTED !
setAttribute( "default-selected", defaultSelected );
}
public String getText()
{
Node child;
StringBuffer text = new StringBuffer();
// Find the Text nodes contained within this element and return their
// concatenated value. Required to go around comments, entities, etc.
child = getFirstChild();
while ( child != null )
{
if ( child instanceof Text ) {
text.append(( (Text) child ).getData());
}
child = child.getNextSibling();
}
return text.toString();
}
public void setText( String text )
{
Node child;
Node next;
// Delete all the nodes and replace them with a single Text node.
// This is the only approach that can handle comments and other nodes.
child = getFirstChild();
while ( child != null )
{
next = child.getNextSibling();
removeChild( child );
child = next;
}
insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() );
}
public int getIndex()
{
Node parent;
NodeList options;
int i;
// Locate the parent SELECT. Note that this OPTION might be inside a
// OPTGROUP inside the SELECT. Or it might not have a parent SELECT.
// Everything is possible. If no parent is found, return -1.
parent = getParentNode();
while ( parent != null && ! ( parent instanceof HTMLSelectElement ) )
parent = parent.getParentNode();
if ( parent != null )
{
// Use getElementsByTagName() which creates a snapshot of all the
// OPTION elements under the SELECT. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
options = ( (HTMLElement) parent ).getElementsByTagName( "OPTION" );
for ( i = 0 ; i < options.getLength() ; ++i )
if ( options.item( i ) == this )
return i;
}
return -1;
}
public void setIndex( int index )
{
Node parent;
NodeList options;
Node item;
// Locate the parent SELECT. Note that this OPTION might be inside a
// OPTGROUP inside the SELECT. Or it might not have a parent SELECT.
// Everything is possible. If no parent is found, just return.
parent = getParentNode();
while ( parent != null && ! ( parent instanceof HTMLSelectElement ) )
parent = parent.getParentNode();
if ( parent != null )
{
// Use getElementsByTagName() which creates a snapshot of all the
// OPTION elements under the SELECT. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
// Make sure this OPTION is not replacing itself.
options = ( (HTMLElement) parent ).getElementsByTagName( "OPTION" );
if ( options.item( index ) != this )
{
// Remove this OPTION from its parent. Place this OPTION right
// before indexed OPTION underneath it's direct parent (might
// be an OPTGROUP).
getParentNode().removeChild( this );
item = options.item( index );
item.getParentNode().insertBefore( this, item );
}
}
}
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getLabel()
{
return capitalize( getAttribute( "label" ) );
}
public void setLabel( String label )
{
setAttribute( "label", label );
}
public boolean getSelected()
{
return getBinary( "selected" );
}
public void setSelected( boolean selected )
{
setAttribute( "selected", selected );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLOptionElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLParagraphElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLParagraphElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLParagraphElementImpl
extends HTMLElementImpl
implements HTMLParagraphElement
{
private static final long serialVersionUID = 8075287150683866287L;
public String getAlign()
{
return getAttribute( "align" );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLParagraphElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,95 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLParamElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLParamElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLParamElementImpl
extends HTMLElementImpl
implements HTMLParamElement
{
private static final long serialVersionUID = -8513050483880341412L;
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
public String getValueType()
{
return capitalize( getAttribute( "valuetype" ) );
}
public void setValueType( String valueType )
{
setAttribute( "valuetype", valueType );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLParamElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLPreElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLPreElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLPreElementImpl
extends HTMLElementImpl
implements HTMLPreElement
{
private static final long serialVersionUID = -4195360849946217644L;
public int getWidth()
{
return getInteger( getAttribute( "width" ) );
}
public void setWidth( int width )
{
setAttribute( "width", String.valueOf( width ) );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLPreElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLQuoteElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLQuoteElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLQuoteElementImpl
extends HTMLElementImpl
implements HTMLQuoteElement
{
private static final long serialVersionUID = -67544811597906132L;
public String getCite()
{
return getAttribute( "cite" );
}
public void setCite( String cite )
{
setAttribute( "cite", cite );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLQuoteElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,157 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.w3c.dom.html.HTMLScriptElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLScriptElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLScriptElementImpl
extends HTMLElementImpl
implements HTMLScriptElement
{
private static final long serialVersionUID = 5090330049085326558L;
public String getText()
{
Node child;
StringBuffer text = new StringBuffer();
// Find the Text nodes contained within this element and return their
// concatenated value. Required to go around comments, entities, etc.
child = getFirstChild();
while ( child != null )
{
if ( child instanceof Text ) {
text.append(( (Text) child ).getData());
}
child = child.getNextSibling();
}
return text.toString();
}
public void setText( String text )
{
Node child;
Node next;
// Delete all the nodes and replace them with a single Text node.
// This is the only approach that can handle comments and other nodes.
child = getFirstChild();
while ( child != null )
{
next = child.getNextSibling();
removeChild( child );
child = next;
}
insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() );
}
public String getHtmlFor()
{
return getAttribute( "for" );
}
public void setHtmlFor( String htmlFor )
{
setAttribute( "for", htmlFor );
}
public String getEvent()
{
return getAttribute( "event" );
}
public void setEvent( String event )
{
setAttribute( "event", event );
}
public String getCharset()
{
return getAttribute( "charset" );
}
public void setCharset( String charset )
{
setAttribute( "charset", charset );
}
public boolean getDefer()
{
return getBinary( "defer" );
}
public void setDefer( boolean defer )
{
setAttribute( "defer", defer );
}
public String getSrc()
{
return getAttribute( "src" );
}
public void setSrc( String src )
{
setAttribute( "src", src );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLScriptElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,233 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLOptionElement;
import org.w3c.dom.html.HTMLSelectElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLSelectElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLSelectElementImpl
extends HTMLElementImpl
implements HTMLSelectElement, HTMLFormControl
{
private static final long serialVersionUID = -6998282711006968187L;
public String getType()
{
return getAttribute( "type" );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
public int getSelectedIndex()
{
NodeList options;
int i;
// Use getElementsByTagName() which creates a snapshot of all the
// OPTION elements under this SELECT. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
// Locate the first selected OPTION and return its index. Note that
// the OPTION might be under an OPTGROUP.
options = getElementsByTagName( "OPTION" );
for ( i = 0 ; i < options.getLength() ; ++i )
if ( ( (HTMLOptionElement) options.item( i ) ).getSelected() )
return i;
return -1;
}
public void setSelectedIndex( int selectedIndex )
{
NodeList options;
int i;
// Use getElementsByTagName() which creates a snapshot of all the
// OPTION elements under this SELECT. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
// Change the select so all OPTIONs are off, except for the
// selectIndex-th one.
options = getElementsByTagName( "OPTION" );
for ( i = 0 ; i < options.getLength() ; ++i )
( (HTMLOptionElementImpl) options.item( i ) ).setSelected( i == selectedIndex );
}
public HTMLCollection getOptions()
{
if ( _options == null )
_options = new HTMLCollectionImpl( this, HTMLCollectionImpl.OPTION );
return _options;
}
public int getLength()
{
return getOptions().getLength();
}
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public boolean getMultiple()
{
return getBinary( "multiple" );
}
public void setMultiple( boolean multiple )
{
setAttribute( "multiple", multiple );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public int getSize()
{
return getInteger( getAttribute( "size" ) );
}
public void setSize( int size )
{
setAttribute( "size", String.valueOf( size ) );
}
public int getTabIndex()
{
return getInteger( getAttribute( "tabindex" ) );
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public void add( HTMLElement element, HTMLElement before )
{
insertBefore( element, before );
}
public void remove( int index )
{
NodeList options;
Node removed;
// Use getElementsByTagName() which creates a snapshot of all the
// OPTION elements under this SELECT. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
// Remove the indexed OPTION from it's parent, this might be this
// SELECT or an OPTGROUP.
options = getElementsByTagName( "OPTION" );
removed = options.item( index );
if ( removed != null )
removed.getParentNode().removeChild ( removed );
}
public void blur()
{
// No scripting in server-side DOM. This method is moot.
}
public void focus()
{
// No scripting in server-side DOM. This method is moot.
}
/**
* Explicit implementation of getChildNodes() to avoid problems with
* overriding the getLength() method hidden in the super class.
*/
public NodeList getChildNodes() {
return getChildNodesUnoptimized();
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getOptions() gets cleared.
*/
public Node cloneNode(boolean deep) {
HTMLSelectElementImpl clonedNode = (HTMLSelectElementImpl)super.cloneNode( deep );
clonedNode._options = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLSelectElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
private HTMLCollection _options;
}

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLStyleElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLStyleElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLStyleElementImpl
extends HTMLElementImpl
implements HTMLStyleElement
{
private static final long serialVersionUID = -9001815754196124532L;
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getMedia()
{
return getAttribute( "media" );
}
public void setMedia( String media )
{
setAttribute( "media", media );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLStyleElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLTableCaptionElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTableCaptionElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableCaptionElementImpl
extends HTMLElementImpl
implements HTMLTableCaptionElement
{
private static final long serialVersionUID = 183703024771848940L;
public String getAlign()
{
return getAttribute( "align" );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableCaptionElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,278 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLTableCellElement;
import org.w3c.dom.html.HTMLTableRowElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTableCellElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableCellElementImpl
extends HTMLElementImpl
implements HTMLTableCellElement
{
private static final long serialVersionUID = -2406518157464313922L;
public int getCellIndex()
{
Node parent;
Node child;
int index;
parent = getParentNode();
index = 0;
if ( parent instanceof HTMLTableRowElement )
{
child = parent.getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableCellElement )
{
if ( child == this )
return index;
++ index;
}
child = child.getNextSibling();
}
}
return -1;
}
public void setCellIndex( int cellIndex )
{
Node parent;
Node child;
parent = getParentNode();
if ( parent instanceof HTMLTableRowElement )
{
child = parent.getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableCellElement )
{
if ( cellIndex == 0 )
{
if ( this != child )
parent.insertBefore( this, child );
return;
}
-- cellIndex;
}
child = child.getNextSibling();
}
}
parent.appendChild( this );
}
public String getAbbr()
{
return getAttribute( "abbr" );
}
public void setAbbr( String abbr )
{
setAttribute( "abbr", abbr );
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getAxis()
{
return getAttribute( "axis" );
}
public void setAxis( String axis )
{
setAttribute( "axis", axis );
}
public String getBgColor()
{
return getAttribute( "bgcolor" );
}
public void setBgColor( String bgColor )
{
setAttribute( "bgcolor", bgColor );
}
public String getCh()
{
String ch;
// Make sure that the access key is a single character.
ch = getAttribute( "char" );
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
return ch;
}
public void setCh( String ch )
{
// Make sure that the access key is a single character.
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
setAttribute( "char", ch );
}
public String getChOff()
{
return getAttribute( "charoff" );
}
public void setChOff( String chOff )
{
setAttribute( "charoff", chOff );
}
public int getColSpan()
{
return getInteger( getAttribute( "colspan" ) );
}
public void setColSpan( int colspan )
{
setAttribute( "colspan", String.valueOf( colspan ) );
}
public String getHeaders()
{
return getAttribute( "headers" );
}
public void setHeaders( String headers )
{
setAttribute( "headers", headers );
}
public String getHeight()
{
return getAttribute( "height" );
}
public void setHeight( String height )
{
setAttribute( "height", height );
}
public boolean getNoWrap()
{
return getBinary( "nowrap" );
}
public void setNoWrap( boolean noWrap )
{
setAttribute( "nowrap", noWrap );
}
public int getRowSpan()
{
return getInteger( getAttribute( "rowspan" ) );
}
public void setRowSpan( int rowspan )
{
setAttribute( "rowspan", String.valueOf( rowspan ) );
}
public String getScope()
{
return getAttribute( "scope" );
}
public void setScope( String scope )
{
setAttribute( "scope", scope );
}
public String getVAlign()
{
return capitalize( getAttribute( "valign" ) );
}
public void setVAlign( String vAlign )
{
setAttribute( "valign", vAlign );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableCellElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,127 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLTableColElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTableColElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableColElementImpl
extends HTMLElementImpl
implements HTMLTableColElement
{
private static final long serialVersionUID = -6189626162811911792L;
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getCh()
{
String ch;
// Make sure that the access key is a single character.
ch = getAttribute( "char" );
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
return ch;
}
public void setCh( String ch )
{
// Make sure that the access key is a single character.
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
setAttribute( "char", ch );
}
public String getChOff()
{
return getAttribute( "charoff" );
}
public void setChOff( String chOff )
{
setAttribute( "charoff", chOff );
}
public int getSpan()
{
return getInteger( getAttribute( "span" ) );
}
public void setSpan( int span )
{
setAttribute( "span", String.valueOf( span ) );
}
public String getVAlign()
{
return capitalize( getAttribute( "valign" ) );
}
public void setVAlign( String vAlign )
{
setAttribute( "valign", vAlign );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableColElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,409 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLTableCaptionElement;
import org.w3c.dom.html.HTMLTableElement;
import org.w3c.dom.html.HTMLTableRowElement;
import org.w3c.dom.html.HTMLTableSectionElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLAnchorElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableElementImpl
extends HTMLElementImpl
implements HTMLTableElement
{
private static final long serialVersionUID = -1824053099870917532L;
public synchronized HTMLTableCaptionElement getCaption()
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableCaptionElement &&
child.getNodeName().equals( "CAPTION" ) )
return (HTMLTableCaptionElement) child;
child = child.getNextSibling();
}
return null;
}
public synchronized void setCaption( HTMLTableCaptionElement caption )
{
if ( caption != null && ! caption.getTagName().equals( "CAPTION" ) )
throw new IllegalArgumentException( "HTM016 Argument 'caption' is not an element of type <CAPTION>." );
deleteCaption();
if ( caption != null )
appendChild( caption );
}
public synchronized HTMLElement createCaption()
{
HTMLElement section;
section = getCaption();
if ( section != null )
return section;
section = new HTMLTableCaptionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "CAPTION" );
appendChild( section );
return section;
}
public synchronized void deleteCaption()
{
Node old;
old = getCaption();
if ( old != null )
removeChild ( old );
}
public synchronized HTMLTableSectionElement getTHead()
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableSectionElement &&
child.getNodeName().equals( "THEAD" ) )
return (HTMLTableSectionElement) child;
child = child.getNextSibling();
}
return null;
}
public synchronized void setTHead( HTMLTableSectionElement tHead )
{
if ( tHead != null && ! tHead.getTagName().equals( "THEAD" ) )
throw new IllegalArgumentException( "HTM017 Argument 'tHead' is not an element of type <THEAD>." );
deleteTHead();
if ( tHead != null )
appendChild( tHead );
}
public synchronized HTMLElement createTHead()
{
HTMLElement section;
section = getTHead();
if ( section != null )
return section;
section = new HTMLTableSectionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "THEAD" );
appendChild( section );
return section;
}
public synchronized void deleteTHead()
{
Node old;
old = getTHead();
if ( old != null )
removeChild ( old );
}
public synchronized HTMLTableSectionElement getTFoot()
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableSectionElement &&
child.getNodeName().equals( "TFOOT" ) )
return (HTMLTableSectionElement) child;
child = child.getNextSibling();
}
return null;
}
public synchronized void setTFoot( HTMLTableSectionElement tFoot )
{
if ( tFoot != null && ! tFoot.getTagName().equals( "TFOOT" ) )
throw new IllegalArgumentException( "HTM018 Argument 'tFoot' is not an element of type <TFOOT>." );
deleteTFoot();
if ( tFoot != null )
appendChild( tFoot );
}
public synchronized HTMLElement createTFoot()
{
HTMLElement section;
section = getTFoot();
if ( section != null )
return section;
section = new HTMLTableSectionElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TFOOT" );
appendChild( section );
return section;
}
public synchronized void deleteTFoot()
{
Node old;
old = getTFoot();
if ( old != null )
removeChild ( old );
}
public HTMLCollection getRows()
{
if ( _rows == null )
_rows = new HTMLCollectionImpl( this, HTMLCollectionImpl.ROW );
return _rows;
}
public HTMLCollection getTBodies()
{
if ( _bodies == null )
_bodies = new HTMLCollectionImpl( this, HTMLCollectionImpl.TBODY );
return _bodies;
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getBgColor()
{
return getAttribute( "bgcolor" );
}
public void setBgColor( String bgColor )
{
setAttribute( "bgcolor", bgColor );
}
public String getBorder()
{
return getAttribute( "border" );
}
public void setBorder( String border )
{
setAttribute( "border", border );
}
public String getCellPadding()
{
return getAttribute( "cellpadding" );
}
public void setCellPadding( String cellPadding )
{
setAttribute( "cellpadding", cellPadding );
}
public String getCellSpacing()
{
return getAttribute( "cellspacing" );
}
public void setCellSpacing( String cellSpacing )
{
setAttribute( "cellspacing", cellSpacing );
}
public String getFrame()
{
return capitalize( getAttribute( "frame" ) );
}
public void setFrame( String frame )
{
setAttribute( "frame", frame );
}
public String getRules()
{
return capitalize( getAttribute( "rules" ) );
}
public void setRules( String rules )
{
setAttribute( "rules", rules );
}
public String getSummary()
{
return getAttribute( "summary" );
}
public void setSummary( String summary )
{
setAttribute( "summary", summary );
}
public String getWidth()
{
return getAttribute( "width" );
}
public void setWidth( String width )
{
setAttribute( "width", width );
}
public HTMLElement insertRow( int index )
{
HTMLTableRowElementImpl newRow;
newRow = new HTMLTableRowElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TR" );
//newRow.insertCell( 0 );
insertRowX( index, newRow );
return newRow;
}
void insertRowX( int index, HTMLTableRowElementImpl newRow )
{
Node child;
Node lastSection = null;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableRowElement )
{
if ( index == 0 )
{
insertBefore( newRow, child );
return;
}
}
else
if ( child instanceof HTMLTableSectionElementImpl )
{
lastSection = child;
index = ( (HTMLTableSectionElementImpl) child ).insertRowX( index, newRow );
if ( index < 0 )
return;
}
child = child.getNextSibling();
}
if ( lastSection != null )
lastSection.appendChild( newRow );
else
appendChild( newRow );
}
public synchronized void deleteRow( int index )
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableRowElement )
{
if ( index == 0 )
{
removeChild ( child );
return;
}
--index;
}
else
if ( child instanceof HTMLTableSectionElementImpl )
{
index = ( (HTMLTableSectionElementImpl) child ).deleteRowX( index );
if ( index < 0 )
return;
}
child = child.getNextSibling();
}
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getRows() and getTBodies() gets cleared.
*/
public Node cloneNode( boolean deep ) {
HTMLTableElementImpl clonedNode = (HTMLTableElementImpl)super.cloneNode( deep );
clonedNode._rows = null;
clonedNode._bodies = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
private HTMLCollectionImpl _rows;
private HTMLCollectionImpl _bodies;
}

View File

@ -0,0 +1,276 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLTableCellElement;
import org.w3c.dom.html.HTMLTableElement;
import org.w3c.dom.html.HTMLTableRowElement;
import org.w3c.dom.html.HTMLTableSectionElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTableRowElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableRowElementImpl
extends HTMLElementImpl
implements HTMLTableRowElement
{
private static final long serialVersionUID = 5409562635656244263L;
public int getRowIndex()
{
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement ) {
parent = parent.getParentNode();
}
if ( parent instanceof HTMLTableElement ) {
return getRowIndex( parent );
}
return -1;
}
public void setRowIndex( int rowIndex )
{
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement ) {
parent = parent.getParentNode();
}
if ( parent instanceof HTMLTableElement ) {
( (HTMLTableElementImpl) parent ).insertRowX( rowIndex, this );
}
}
public int getSectionRowIndex()
{
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement ) {
return getRowIndex( parent );
}
return -1;
}
public void setSectionRowIndex( int sectionRowIndex )
{
Node parent;
parent = getParentNode();
if ( parent instanceof HTMLTableSectionElement ) {
( (HTMLTableSectionElementImpl) parent ).insertRowX( sectionRowIndex, this );
}
}
int getRowIndex( Node parent )
{
NodeList rows;
int i;
// Use getElementsByTagName() which creates a snapshot of all the
// TR elements under the TABLE/section. Access to the returned NodeList
// is very fast and the snapshot solves many synchronization problems.
rows = ( (HTMLElement) parent ).getElementsByTagName( "TR" );
for ( i = 0 ; i < rows.getLength() ; ++i ) {
if ( rows.item( i ) == this ) {
return i;
}
}
return -1;
}
public HTMLCollection getCells()
{
if ( _cells == null ) {
_cells = new HTMLCollectionImpl( this, HTMLCollectionImpl.CELL );
}
return _cells;
}
public void setCells( HTMLCollection cells )
{
Node child;
int i;
child = getFirstChild();
while ( child != null ) {
removeChild( child );
child = child.getNextSibling();
}
i = 0;
child = cells.item( i );
while ( child != null ) {
appendChild ( child );
++i;
child = cells.item( i );
}
}
public HTMLElement insertCell( int index )
{
Node child;
HTMLElement newCell;
newCell = new HTMLTableCellElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TD" );
child = getFirstChild();
while ( child != null ) {
if ( child instanceof HTMLTableCellElement ) {
if ( index == 0 ) {
insertBefore( newCell, child );
return newCell;
}
--index;
}
child = child.getNextSibling();
}
appendChild( newCell );
return newCell;
}
public void deleteCell( int index )
{
Node child;
child = getFirstChild();
while ( child != null ) {
if ( child instanceof HTMLTableCellElement ) {
if ( index == 0 ) {
removeChild ( child );
return;
}
--index;
}
child = child.getNextSibling();
}
}
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getBgColor()
{
return getAttribute( "bgcolor" );
}
public void setBgColor( String bgColor )
{
setAttribute( "bgcolor", bgColor );
}
public String getCh()
{
String ch;
// Make sure that the access key is a single character.
ch = getAttribute( "char" );
if ( ch != null && ch.length() > 1 ) {
ch = ch.substring( 0, 1 );
}
return ch;
}
public void setCh( String ch )
{
// Make sure that the access key is a single character.
if ( ch != null && ch.length() > 1 ) {
ch = ch.substring( 0, 1 );
}
setAttribute( "char", ch );
}
public String getChOff()
{
return getAttribute( "charoff" );
}
public void setChOff( String chOff )
{
setAttribute( "charoff", chOff );
}
public String getVAlign()
{
return capitalize( getAttribute( "valign" ) );
}
public void setVAlign( String vAlign )
{
setAttribute( "valign", vAlign );
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getCells() gets cleared.
*/
public Node cloneNode( boolean deep ) {
HTMLTableRowElementImpl clonedNode = (HTMLTableRowElementImpl)super.cloneNode( deep );
clonedNode._cells = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableRowElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
HTMLCollection _cells;
}

View File

@ -0,0 +1,190 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.html.HTMLCollection;
import org.w3c.dom.html.HTMLElement;
import org.w3c.dom.html.HTMLTableRowElement;
import org.w3c.dom.html.HTMLTableSectionElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTableSectionElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTableSectionElementImpl
extends HTMLElementImpl
implements HTMLTableSectionElement
{
private static final long serialVersionUID = 1016412997716618027L;
public String getAlign()
{
return capitalize( getAttribute( "align" ) );
}
public void setAlign( String align )
{
setAttribute( "align", align );
}
public String getCh()
{
String ch;
// Make sure that the access key is a single character.
ch = getAttribute( "char" );
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
return ch;
}
public void setCh( String ch )
{
// Make sure that the access key is a single character.
if ( ch != null && ch.length() > 1 )
ch = ch.substring( 0, 1 );
setAttribute( "char", ch );
}
public String getChOff()
{
return getAttribute( "charoff" );
}
public void setChOff( String chOff )
{
setAttribute( "charoff", chOff );
}
public String getVAlign()
{
return capitalize( getAttribute( "valign" ) );
}
public void setVAlign( String vAlign )
{
setAttribute( "valign", vAlign );
}
public HTMLCollection getRows()
{
if ( _rows == null )
_rows = new HTMLCollectionImpl( this, HTMLCollectionImpl.ROW );
return _rows;
}
public HTMLElement insertRow( int index )
{
HTMLTableRowElementImpl newRow;
newRow = new HTMLTableRowElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TR" );
newRow.insertCell( 0 );
if ( insertRowX( index, newRow ) >= 0 )
appendChild( newRow );
return newRow;
}
int insertRowX( int index, HTMLTableRowElementImpl newRow )
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableRowElement )
{
if ( index == 0 )
{
insertBefore( newRow, child );
return -1;
}
--index;
}
child = child.getNextSibling();
}
return index;
}
public void deleteRow( int index )
{
deleteRowX( index );
}
int deleteRowX( int index )
{
Node child;
child = getFirstChild();
while ( child != null )
{
if ( child instanceof HTMLTableRowElement )
{
if ( index == 0 )
{
removeChild ( child );
return -1;
}
--index;
}
child = child.getNextSibling();
}
return index;
}
/**
* Explicit implementation of cloneNode() to ensure that cache used
* for getRows() gets cleared.
*/
public Node cloneNode( boolean deep ) {
HTMLTableSectionElementImpl clonedNode = (HTMLTableSectionElementImpl)super.cloneNode( deep );
clonedNode._rows = null;
return clonedNode;
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTableSectionElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
private HTMLCollectionImpl _rows;
}

View File

@ -0,0 +1,191 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLTextAreaElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTextAreaElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTextAreaElementImpl
extends HTMLElementImpl
implements HTMLTextAreaElement, HTMLFormControl
{
private static final long serialVersionUID = -6737778308542678104L;
public String getDefaultValue()
{
// ! NOT FULLY IMPLEMENTED !
return getAttribute( "default-value" );
}
public void setDefaultValue( String defaultValue )
{
// ! NOT FULLY IMPLEMENTED !
setAttribute( "default-value", defaultValue );
}
public String getAccessKey()
{
String accessKey;
// Make sure that the access key is a single character.
accessKey = getAttribute( "accesskey" );
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
return accessKey;
}
public void setAccessKey( String accessKey )
{
// Make sure that the access key is a single character.
if ( accessKey != null && accessKey.length() > 1 )
accessKey = accessKey.substring( 0, 1 );
setAttribute( "accesskey", accessKey );
}
public int getCols()
{
return getInteger( getAttribute( "cols" ) );
}
public void setCols( int cols )
{
setAttribute( "cols", String.valueOf( cols ) );
}
public boolean getDisabled()
{
return getBinary( "disabled" );
}
public void setDisabled( boolean disabled )
{
setAttribute( "disabled", disabled );
}
public String getName()
{
return getAttribute( "name" );
}
public void setName( String name )
{
setAttribute( "name", name );
}
public boolean getReadOnly()
{
return getBinary( "readonly" );
}
public void setReadOnly( boolean readOnly )
{
setAttribute( "readonly", readOnly );
}
public int getRows()
{
return getInteger( getAttribute( "rows" ) );
}
public void setRows( int rows )
{
setAttribute( "rows", String.valueOf( rows ) );
}
public int getTabIndex()
{
return getInteger( getAttribute( "tabindex" ) );
}
public void setTabIndex( int tabIndex )
{
setAttribute( "tabindex", String.valueOf( tabIndex ) );
}
public String getType()
{
return getAttribute( "type" );
}
public String getValue()
{
return getAttribute( "value" );
}
public void setValue( String value )
{
setAttribute( "value", value );
}
public void blur()
{
// No scripting in server-side DOM. This method is moot.
}
public void focus()
{
// No scripting in server-side DOM. This method is moot.
}
public void select()
{
// No scripting in server-side DOM. This method is moot.
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTextAreaElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,86 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import org.w3c.dom.html.HTMLTitleElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLTitleElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLTitleElementImpl
extends HTMLElementImpl
implements HTMLTitleElement
{
private static final long serialVersionUID = 879646303512367875L;
public String getText()
{
Node child;
StringBuffer text = new StringBuffer();
// Find the Text nodes contained within this element and return their
// concatenated value. Required to go around comments, entities, etc.
child = getFirstChild();
while ( child != null )
{
if ( child instanceof Text ) {
text.append(( (Text) child ).getData());
}
child = child.getNextSibling();
}
return text.toString();
}
public void setText( String text )
{
Node child;
Node next;
// Delete all the nodes and replace them with a single Text node.
// This is the only approach that can handle comments and other nodes.
child = getFirstChild();
while ( child != null )
{
next = child.getNextSibling();
removeChild( child );
child = next;
}
insertBefore( getOwnerDocument().createTextNode( text ), getFirstChild() );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLTitleElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,71 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.w3c.dom.html.HTMLUListElement;
/**
* @xerces.internal
* @version $Revision$ $Date$
* @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
* @see org.w3c.dom.html.HTMLUListElement
* @see org.apache.xerces.dom.ElementImpl
*/
public class HTMLUListElementImpl
extends HTMLElementImpl
implements HTMLUListElement
{
private static final long serialVersionUID = -3220401442015109211L;
public boolean getCompact()
{
return getBinary( "compact" );
}
public void setCompact( boolean compact )
{
setAttribute( "compact", compact );
}
public String getType()
{
return getAttribute( "type" );
}
public void setType( String type )
{
setAttribute( "type", type );
}
/**
* Constructor requires owner document.
*
* @param owner The owner HTML document
*/
public HTMLUListElementImpl( HTMLDocumentImpl owner, String name )
{
super( owner, name );
}
}

View File

@ -0,0 +1,96 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import org.apache.xerces.dom.DeepNodeListImpl;
import org.apache.xerces.dom.ElementImpl;
import org.apache.xerces.dom.NodeImpl;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* This class implements the DOM's NodeList behavior for
* HTMLDocuemnt.getElementsByName().
*
* @xerces.internal
*
* @version $Id$
* @since PR-DOM-Level-1-19980818.
* @see DeepNodeListImpl
*/
public class NameNodeListImpl
extends DeepNodeListImpl
implements NodeList {
/** Constructor. */
public NameNodeListImpl(NodeImpl rootNode, String tagName) {
super( rootNode, tagName );
}
/**
* Iterative tree-walker. When you have a Parent link, there's often no
* need to resort to recursion. NOTE THAT only Element nodes are matched
* since we're specifically supporting getElementsByTagName().
*/
protected Node nextMatchingElementAfter(Node current) {
Node next;
while (current != null) {
// Look down to first child.
if (current.hasChildNodes()) {
current = (current.getFirstChild());
}
// Look right to sibling (but not from root!)
else if (current != rootNode && null != (next = current.getNextSibling())) {
current = next;
}
// Look up and right (but not past root!)
else {
next = null;
for (; current != rootNode; // Stop when we return to starting point
current = current.getParentNode()) {
next = current.getNextSibling();
if (next != null)
break;
}
current = next;
}
// Have we found an Element with the right tagName?
// ("*" matches anything.)
if (current != rootNode && current != null
&& current.getNodeType() == Node.ELEMENT_NODE ) {
String name = ((ElementImpl) current).getAttribute( "name" );
if ( name.equals("*") || name.equals(tagName))
return current;
}
// Otherwise continue walking the tree
}
// Fell out of tree-walk; no more instances found
return null;
} // nextMatchingElementAfter(int):Node
} // class NameNodeListImpl

View File

@ -0,0 +1,545 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
/**
* This class is duplicated for each JAXP subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the JAXP
* API.
* <p>
* This code is designed to implement the JAXP 1.1 spec pluggability
* feature and is designed to run on JDK version 1.1 and
* later, and to compile on JDK 1.2 and onward.
* The code also runs both as part of an unbundled jar file and
* when bundled as part of the JDK.
* <p>
*
* @xerces.internal
*
* @version $Id$
*/
final class ObjectFactory {
//
// Constants
//
// name of default properties file to look for in JDK's jre/lib directory
private static final String DEFAULT_PROPERTIES_FILENAME = "xerces.properties";
/** Set to true for debugging */
private static final boolean DEBUG = isDebugEnabled();
/**
* Default columns per line.
*/
private static final int DEFAULT_LINE_LENGTH = 80;
/** cache the contents of the xerces.properties file.
* Until an attempt has been made to read this file, this will
* be null; if the file does not exist or we encounter some other error
* during the read, this will be empty.
*/
private static Properties fXercesProperties = null;
/***
* Cache the time stamp of the xerces.properties file so
* that we know if it's been modified and can invalidate
* the cache when necessary.
*/
private static long fLastModified = -1;
//
// static methods
//
/**
* Finds the implementation Class object in the specified order. The
* specified order is the following:
* <ol>
* <li>query the system property using <code>System.getProperty</code>
* <li>read <code>META-INF/services/<i>factoryId</i></code> file
* <li>use fallback classname
* </ol>
*
* @return Class object of factory, never null
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param fallbackClassName Implementation class name, if nothing else
* is found. Use null to mean no fallback.
*
* @exception ObjectFactory.ConfigurationError
*/
static Object createObject(String factoryId, String fallbackClassName)
throws ConfigurationError {
return createObject(factoryId, null, fallbackClassName);
} // createObject(String,String):Object
/**
* Finds the implementation Class object in the specified order. The
* specified order is the following:
* <ol>
* <li>query the system property using <code>System.getProperty</code>
* <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
* <li>read <code>META-INF/services/<i>factoryId</i></code> file
* <li>use fallback classname
* </ol>
*
* @return Class object of factory, never null
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param propertiesFilename The filename in the $java.home/lib directory
* of the properties file. If none specified,
* ${java.home}/lib/xerces.properties will be used.
* @param fallbackClassName Implementation class name, if nothing else
* is found. Use null to mean no fallback.
*
* @exception ObjectFactory.ConfigurationError
*/
static Object createObject(String factoryId,
String propertiesFilename,
String fallbackClassName)
throws ConfigurationError
{
if (DEBUG) debugPrintln("debug is on");
ClassLoader cl = findClassLoader();
// Use the system property first
try {
String systemProp = SecuritySupport.getSystemProperty(factoryId);
if (systemProp != null && systemProp.length() > 0) {
if (DEBUG) debugPrintln("found system property, value=" + systemProp);
return newInstance(systemProp, cl, true);
}
} catch (SecurityException se) {
// Ignore and continue w/ next location
}
// Try to read from propertiesFilename, or $java.home/lib/xerces.properties
String factoryClassName = null;
// no properties file name specified; use $JAVA_HOME/lib/xerces.properties:
if (propertiesFilename == null) {
File propertiesFile = null;
boolean propertiesFileExists = false;
try {
String javah = SecuritySupport.getSystemProperty("java.home");
propertiesFilename = javah + File.separator +
"lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
propertiesFile = new File(propertiesFilename);
propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
} catch (SecurityException e) {
// try again...
fLastModified = -1;
fXercesProperties = null;
}
synchronized (ObjectFactory.class) {
boolean loadProperties = false;
FileInputStream fis = null;
try {
// file existed last time
if(fLastModified >= 0) {
if(propertiesFileExists &&
(fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
loadProperties = true;
} else {
// file has stopped existing...
if(!propertiesFileExists) {
fLastModified = -1;
fXercesProperties = null;
} // else, file wasn't modified!
}
} else {
// file has started to exist:
if(propertiesFileExists) {
loadProperties = true;
fLastModified = SecuritySupport.getLastModified(propertiesFile);
} // else, nothing's changed
}
if(loadProperties) {
// must never have attempted to read xerces.properties before (or it's outdeated)
fXercesProperties = new Properties();
fis = SecuritySupport.getFileInputStream(propertiesFile);
fXercesProperties.load(fis);
}
} catch (Exception x) {
fXercesProperties = null;
fLastModified = -1;
// assert(x instanceof FileNotFoundException
// || x instanceof SecurityException)
// In both cases, ignore and continue w/ next location
}
finally {
// try to close the input stream if one was opened.
if (fis != null) {
try {
fis.close();
}
// Ignore the exception.
catch (IOException exc) {}
}
}
}
if(fXercesProperties != null) {
factoryClassName = fXercesProperties.getProperty(factoryId);
}
} else {
FileInputStream fis = null;
try {
fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
Properties props = new Properties();
props.load(fis);
factoryClassName = props.getProperty(factoryId);
} catch (Exception x) {
// assert(x instanceof FileNotFoundException
// || x instanceof SecurityException)
// In both cases, ignore and continue w/ next location
}
finally {
// try to close the input stream if one was opened.
if (fis != null) {
try {
fis.close();
}
// Ignore the exception.
catch (IOException exc) {}
}
}
}
if (factoryClassName != null) {
if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value=" + factoryClassName);
return newInstance(factoryClassName, cl, true);
}
// Try Jar Service Provider Mechanism
Object provider = findJarServiceProvider(factoryId);
if (provider != null) {
return provider;
}
if (fallbackClassName == null) {
throw new ConfigurationError(
"Provider for " + factoryId + " cannot be found", null);
}
if (DEBUG) debugPrintln("using fallback, value=" + fallbackClassName);
return newInstance(fallbackClassName, cl, true);
} // createObject(String,String,String):Object
//
// Private static methods
//
/** Returns true if debug has been enabled. */
private static boolean isDebugEnabled() {
try {
String val = SecuritySupport.getSystemProperty("xerces.debug");
// Allow simply setting the prop to turn on debug
return (val != null && (!"false".equals(val)));
}
catch (SecurityException se) {}
return false;
} // isDebugEnabled()
/** Prints a message to standard error if debugging is enabled. */
private static void debugPrintln(String msg) {
if (DEBUG) {
System.err.println("XERCES: " + msg);
}
} // debugPrintln(String)
/**
* Figure out which ClassLoader to use. For JDK 1.2 and later use
* the context ClassLoader.
*/
static ClassLoader findClassLoader()
throws ConfigurationError
{
// Figure out which ClassLoader to use for loading the provider
// class. If there is a Context ClassLoader then use it.
ClassLoader context = SecuritySupport.getContextClassLoader();
ClassLoader system = SecuritySupport.getSystemClassLoader();
ClassLoader chain = system;
while (true) {
if (context == chain) {
// Assert: we are on JDK 1.1 or we have no Context ClassLoader
// or any Context ClassLoader in chain of system classloader
// (including extension ClassLoader) so extend to widest
// ClassLoader (always look in system ClassLoader if Xerces
// is in boot/extension/system classpath and in current
// ClassLoader otherwise); normal classloaders delegate
// back to system ClassLoader first so this widening doesn't
// change the fact that context ClassLoader will be consulted
ClassLoader current = ObjectFactory.class.getClassLoader();
chain = system;
while (true) {
if (current == chain) {
// Assert: Current ClassLoader in chain of
// boot/extension/system ClassLoaders
return system;
}
if (chain == null) {
break;
}
chain = SecuritySupport.getParentClassLoader(chain);
}
// Assert: Current ClassLoader not in chain of
// boot/extension/system ClassLoaders
return current;
}
if (chain == null) {
// boot ClassLoader reached
break;
}
// Check for any extension ClassLoaders in chain up to
// boot ClassLoader
chain = SecuritySupport.getParentClassLoader(chain);
};
// Assert: Context ClassLoader not in chain of
// boot/extension/system ClassLoaders
return context;
} // findClassLoader():ClassLoader
/**
* Create an instance of a class using the specified ClassLoader
*/
static Object newInstance(String className, ClassLoader cl,
boolean doFallback)
throws ConfigurationError
{
// assert(className != null);
try{
Class providerClass = findProviderClass(className, cl, doFallback);
Object instance = providerClass.newInstance();
if (DEBUG) debugPrintln("created new instance of " + providerClass +
" using ClassLoader: " + cl);
return instance;
} catch (ClassNotFoundException x) {
throw new ConfigurationError(
"Provider " + className + " not found", x);
} catch (Exception x) {
throw new ConfigurationError(
"Provider " + className + " could not be instantiated: " + x,
x);
}
}
/**
* Find a Class using the specified ClassLoader
*/
static Class findProviderClass(String className, ClassLoader cl,
boolean doFallback)
throws ClassNotFoundException, ConfigurationError
{
//throw security exception if the calling thread is not allowed to access the package
//restrict the access to package as specified in java.security policy
SecurityManager security = System.getSecurityManager();
if (security != null) {
final int lastDot = className.lastIndexOf('.');
String packageName = className;
if (lastDot != -1) packageName = className.substring(0, lastDot);
security.checkPackageAccess(packageName);
}
Class providerClass;
if (cl == null) {
// XXX Use the bootstrap ClassLoader. There is no way to
// load a class using the bootstrap ClassLoader that works
// in both JDK 1.1 and Java 2. However, this should still
// work b/c the following should be true:
//
// (cl == null) iff current ClassLoader == null
//
// Thus Class.forName(String) will use the current
// ClassLoader which will be the bootstrap ClassLoader.
providerClass = Class.forName(className);
} else {
try {
providerClass = cl.loadClass(className);
} catch (ClassNotFoundException x) {
if (doFallback) {
// Fall back to current classloader
ClassLoader current = ObjectFactory.class.getClassLoader();
if (current == null) {
providerClass = Class.forName(className);
} else if (cl != current) {
cl = current;
providerClass = cl.loadClass(className);
} else {
throw x;
}
} else {
throw x;
}
}
}
return providerClass;
}
/*
* Try to find provider using Jar Service Provider Mechanism
*
* @return instance of provider class if found or null
*/
private static Object findJarServiceProvider(String factoryId)
throws ConfigurationError
{
String serviceId = "META-INF/services/" + factoryId;
InputStream is = null;
// First try the Context ClassLoader
ClassLoader cl = findClassLoader();
is = SecuritySupport.getResourceAsStream(cl, serviceId);
// If no provider found then try the current ClassLoader
if (is == null) {
ClassLoader current = ObjectFactory.class.getClassLoader();
if (cl != current) {
cl = current;
is = SecuritySupport.getResourceAsStream(cl, serviceId);
}
}
if (is == null) {
// No provider found
return null;
}
if (DEBUG) debugPrintln("found jar resource=" + serviceId +
" using ClassLoader: " + cl);
// Read the service provider name in UTF-8 as specified in
// the jar spec. Unfortunately this fails in Microsoft
// VJ++, which does not implement the UTF-8
// encoding. Theoretically, we should simply let it fail in
// that case, since the JVM is obviously broken if it
// doesn't support such a basic standard. But since there
// are still some users attempting to use VJ++ for
// development, we have dropped in a fallback which makes a
// second attempt using the platform's default encoding. In
// VJ++ this is apparently ASCII, which is a subset of
// UTF-8... and since the strings we'll be reading here are
// also primarily limited to the 7-bit ASCII range (at
// least, in English versions), this should work well
// enough to keep us on the air until we're ready to
// officially decommit from VJ++. [Edited comment from
// jkesselm]
BufferedReader rd;
try {
rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH);
} catch (java.io.UnsupportedEncodingException e) {
rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH);
}
String factoryClassName = null;
try {
// XXX Does not handle all possible input as specified by the
// Jar Service Provider specification
factoryClassName = rd.readLine();
} catch (IOException x) {
// No provider found
return null;
}
finally {
try {
// try to close the reader.
rd.close();
}
// Ignore the exception.
catch (IOException exc) {}
}
if (factoryClassName != null &&
! "".equals(factoryClassName)) {
if (DEBUG) debugPrintln("found in resource, value="
+ factoryClassName);
// Note: here we do not want to fall back to the current
// ClassLoader because we want to avoid the case where the
// resource file was found using one ClassLoader and the
// provider class was instantiated using a different one.
return newInstance(factoryClassName, cl, false);
}
// No provider found
return null;
}
//
// Classes
//
/**
* A configuration error.
*/
static final class ConfigurationError
extends Error {
/** Serialization version. */
static final long serialVersionUID = 2646822752226280048L;
//
// Data
//
/** Exception. */
private Exception exception;
//
// Constructors
//
/**
* Construct a new instance with the specified detail string and
* exception.
*/
ConfigurationError(String msg, Exception x) {
super(msg);
this.exception = x;
} // <init>(String,Exception)
//
// methods
//
/** Returns the exception associated to this error. */
Exception getException() {
return exception;
} // getException():Exception
} // class ConfigurationError
} // class ObjectFactory

View File

@ -0,0 +1,141 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.html.dom;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
* This class is duplicated for each subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of any API.
*
* @xerces.internal
*
* @version $Id$
*/
final class SecuritySupport {
static ClassLoader getContextClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (SecurityException ex) { }
return cl;
}
});
}
static ClassLoader getSystemClassLoader() {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader cl = null;
try {
cl = ClassLoader.getSystemClassLoader();
} catch (SecurityException ex) {}
return cl;
}
});
}
static ClassLoader getParentClassLoader(final ClassLoader cl) {
return (ClassLoader)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
ClassLoader parent = null;
try {
parent = cl.getParent();
} catch (SecurityException ex) {}
// eliminate loops in case of the boot
// ClassLoader returning itself as a parent
return (parent == cl) ? null : parent;
}
});
}
static String getSystemProperty(final String propName) {
return (String)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propName);
}
});
}
static FileInputStream getFileInputStream(final File file)
throws FileNotFoundException
{
try {
return (FileInputStream)
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException)e.getException();
}
}
static InputStream getResourceAsStream(final ClassLoader cl,
final String name)
{
return (InputStream)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
InputStream ris;
if (cl == null) {
ris = ClassLoader.getSystemResourceAsStream(name);
} else {
ris = cl.getResourceAsStream(name);
}
return ris;
}
});
}
static boolean getFileExists(final File f) {
return ((Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return f.exists() ? Boolean.TRUE : Boolean.FALSE;
}
})).booleanValue();
}
static long getLastModified(final File f) {
return ((Long)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Long(f.lastModified());
}
})).longValue();
}
private SecuritySupport () {}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLAElement extends WMLElement {
public void setHref(String newValue);
public String getHref();
public void setTitle(String newValue);
public String getTitle();
public void setId(String newValue);
public String getId();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'access' element specifics the access control for the entire deck
* (Section 11.3.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLAccessElement extends WMLElement {
/**
* A deck's domain and path attributes specify which deck may
* access it.
*
* domain attribute is suffix-matched against the domain name
* portion of the referring URI
*/
public void setDomain(String newValue);
public String getDomain();
/**
* path attribute is prefix-matched against the path portion of
* the referring URI
*/
public void setPath(String newValue);
public String getPath();
}

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLAnchorElement extends WMLElement {
public void setTitle(String newValue);
public String getTitle();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'b' element boldface the text
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLBElement extends WMLElement {
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'big' element renders the text with big font
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLBigElement extends WMLElement {
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'br' element starts a new line</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLBrElement extends WMLElement {
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,88 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'card' element is the basic display unit of WML. A WML decks
* contains a collection of cards.
* (Section 11.5, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLCardElement extends WMLElement {
/**
* 'onenterbackward' specifies the event to occur when a user
* agent into a card using a 'go' task
* (Section 11.5.1, WAP WML Version 16-Jun-1999)
*/
public void setOnEnterBackward(String href);
public String getOnEnterBackward();
/**
* 'onenterforward' specifies the event to occur when a user
* agent into a card using a 'prev' task
* (Section 11.5.1, WAP WML Version 16-Jun-1999)
*/
public void setOnEnterForward(String href);
public String getOnEnterForward();
/**
* 'onenterbackward' specifies the event to occur when a timer expires
* (Section 11.5.1, WAP WML Version 16-Jun-1999)
*/
public void setOnTimer(String href);
public String getOnTimer();
/**
* 'title' specifies a advisory info about the card
* (Section 11.5.2, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'newcontext' specifies whether a browser context should be
* re-initialized upon entering the card. Default to be false.
* (Section 11.5.2, WAP WML Version 16-Jun-1999)
*/
public void setNewContext(boolean newValue);
public boolean getNewContext();
/**
* 'ordered' attribute specifies a hit to user agent about the
* organization of the card's content
* (Section 11.5.2, WAP WML Version 16-Jun-1999)
*/
public void setOrdered(boolean newValue);
public boolean getOrdered();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
import org.w3c.dom.DOMImplementation;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLDOMImplementation extends DOMImplementation {
}

View File

@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLDoElement extends WMLElement {
public void setOptional(String newValue);
public String getOptional();
public void setLabel(String newValue);
public String getLabel();
public void setType(String newValue);
public String getType();
public void setName(String newValue);
public String getName();
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
import org.w3c.dom.Document;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLDocument extends Document {
}

View File

@ -0,0 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
import org.w3c.dom.Element;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>All WML Elements are derived from this class that contains two
* core attributes defined in the DTD.</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLElement extends Element {
/**
* The element's identifier which is unique in a single deck.
* (Section 8.9, WAP WML Version 16-Jun-1999)
*/
public void setId(String newValue);
public String getId();
/**
* The 'class' attribute of a element that affiliates an elements
* with one or more elements.
* (Section 8.9, WAP WML Version 16-Jun-1999)
*/
public void setClassName(String newValue);
public String getClassName();
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'em' element emphasis the text
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLEmElement extends WMLElement {
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'fieldset' element groups related fields and tet
* (Section 11.6.4, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLFieldsetElement extends WMLElement {
/**
* 'title' specifies a title for this element
*/
public void setTitle(String newValue);
public String getTitle();
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLGoElement extends WMLElement {
public void setSendreferer(String newValue);
public String getSendreferer();
public void setAcceptCharset(String newValue);
public String getAcceptCharset();
public void setHref(String newValue);
public String getHref();
public void setMethod(String newValue);
public String getMethod();
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>The head element contains information about a deck.
* (Section 11.3, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLHeadElement extends WMLElement {
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'i' italic the text
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLIElement extends WMLElement {
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,100 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'img' specifies an image in a text flow
* (Section 11.9, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLImgElement extends WMLElement {
/**
* 'alt' specifies an alternative text for the image
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setAlt(String newValue);
public String getAlt();
/**
* 'src' specifies URI for the source images
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setSrc(String newValue);
public String getSrc();
/**
* 'localsrc' specifies an alternative internal representation of
* the image.
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setLocalSrc(String newValue);
public String getLocalSrc();
/**
* 'vspace' specifies the abount of white space to be inserted
* above and below
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setVspace(String newValue);
public String getVspace();
/**
* 'hspace' specifies the abount of white space to be inserted
* left and right
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setHspace(String newValue);
public String getHspace();
/**
* 'align' specifies the alignment of the image within the text
* flow.
* (Section 11.8, WAP WML Version 16-Jun-1999)
*/
public void setAlign(String newValue);
public String getAlign();
/**
* 'width' specifies the width of an image.
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setWidth(String newValue);
public String getWidth();
/**
* 'height' specifies the height of an image.
* (Section 11.9, WAP WML Version 16-Jun-1999)
*/
public void setHeight(String newValue);
public String getHeight();
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,107 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'input' element specifies a text entry object.
* (Section 11.6.3, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLInputElement extends WMLElement {
/**
* 'name' specifies the name of a variable after the user enters the text.
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setName(String newValue);
public String getName();
/**
* 'value' specifies the default value of the variable in 'name' attribute
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setValue(String newValue);
public String getValue();
/**
* 'type' specifies the type of text input area.
* Two values are allowed: 'text' and 'password' and default is 'text'
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setType(String newValue);
public String getType();
/**
* 'format' specifies the input mask for user input.
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setFormat(String newValue);
public String getFormat();
/**
* 'emptyok' specifies whether a empty input is allowed when a
* non-empty 'format' is specified. Default to be 'false'
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setEmptyOk(boolean newValue);
public boolean getEmptyOk();
/**
* 'size' specifies the width of the input in characters
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setSize(int newValue);
public int getSize();
/**
* 'maxlength' specifies the maximum number of characters to be
* enter.
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setMaxLength(int newValue);
public int getMaxLength();
/**
* 'title' specifies a title for this element
* (Section 11.6.3, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'tabindex' specifies the tabbing position of the element
* (Section 11.6.1, WAP WML Version 16-Jun-1999)
*/
public void setTabIndex(int newValue);
public int getTabIndex();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,66 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>The meta element contains meta-info of an WML deck
* (Section 11.3.2, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLMetaElement extends WMLElement {
/**
* 'name' attribute specific the property name
*/
public void setName(String newValue);
public String getName();
/**
* 'http-equiv' attribute indicates the property should be
* interpret as HTTP header.
*/
public void setHttpEquiv(String newValue);
public String getHttpEquiv();
/**
* 'forua' attribute specifies whether a intermediate agent should
* remove this meta element. A value of false means the
* intermediate agent must remove the element.
*/
public void setForua(boolean newValue);
public boolean getForua();
/**
* 'scheme' attribute specifies a form that may be used to
* interpret the property value
*/
public void setScheme(String newValue);
public String getScheme();
/**
* 'content' attribute specifies the property value
*/
public void setContent(String newValue);
public String getContent();
}

View File

@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLNoopElement extends WMLElement {
}

View File

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLOneventElement extends WMLElement {
public void setType(String newValue);
public String getType();
}

View File

@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'optgroup' element groups related 'option' elements into a
* hierarchy. (Section 11.6.2.2, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLOptgroupElement extends WMLElement {
/**
* 'title' specifies the title of this element
* (Section 11.6.2.3, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'option' element specifies a choice in a 'select' element</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLOptionElement extends WMLElement {
/**
* 'value' specifies the value to used to set the 'name' variable
* (Section 11.6.2.2, WAP WML Version 16-Jun-1999)
*/
public void setValue(String newValue);
public String getValue();
/**
* 'title' specifies a title for this element.
* (Section 11.6.2.2, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'onpick' specifies a event to occur when a user select and
* disselect this choice.
* (Section 11.6.2.2, WAP WML Version 16-Jun-1999) */
public void setOnPick(String href);
public String getOnPick();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,57 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'p' element specifies a paragraph
* (Section 11.8.3, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLPElement extends WMLElement {
/**
* 'mode' specifies the wrapping mode of the paragraph.
* The legal values are 'wrap' and 'nowrap'
* (Section 11.8.3, WAP WML Version 16-Jun-1999)
*/
public void setMode(String newValue);
public String getMode();
/**
* 'align' specifies the align of teh paragraph
* The legal values are 'left,' 'center,' and 'right'
* (Section 11.8.3, WAP WML Version 16-Jun-1999)
*/
public void setAlign(String newValue);
public String getAlign();
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLPostfieldElement extends WMLElement {
public void setValue(String newValue);
public String getValue();
public void setName(String newValue);
public String getName();
}

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLPrevElement extends WMLElement {
}

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLRefreshElement extends WMLElement {
}

View File

@ -0,0 +1,89 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'select' element lets user pick from a list of options.
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLSelectElement extends WMLElement {
/**
* 'tabindex' specifies the tabbing position of the element
* (Section 11.6.1, WAP WML Version 16-Jun-1999)
*/
public void setTabIndex(int newValue);
public int getTabIndex();
/**
* 'multiple' indicates whether a list accept multiple selection
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)
*/
public void setMultiple(boolean newValue);
public boolean getMultiple();
/**
* 'name' specifies the name of variable to be set.
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)
*/
public void setName(String newValue);
public String getName();
/**
* 'value' specifics the default value of the variable of 'name'
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)
*/
public void setValue(String newValue);
public String getValue();
/**
* 'title' specifies a title for this element
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'iname' specifies name of variable to be set with the index
* result of selection.
* (Section 11.6.2.1, WAP WML Version 16-Jun-1999)
*/
public void setIName(String newValue);
public String getIName();
/**
* 'ivalue' specifies the default of the variable 'iname'
*/
public void setIValue(String newValue);
public String getIValue();
/**
* 'xml:lang' specifics the natural or formal language in which
* the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLSetvarElement extends WMLElement {
public void setValue(String newValue);
public String getValue();
public void setName(String newValue);
public String getName();
}

View File

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'small' render the text with small font
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLSmallElement extends WMLElement {
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'strong' strongly emphasis the text
* (Section 11.8.1, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLStrongElement extends WMLElement {
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,62 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'table' create a set of aligned columns of text and images.
* (Section 11.8.5, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLTableElement extends WMLElement {
/**
* 'title' specifies a title for the table
* (Section 11.8.5, WAP WML Version 16-Jun-1999)
*/
public void setTitle(String newValue);
public String getTitle();
/**
* 'align' set the align of the table
* (Section 11.8.5, WAP WML Version 16-Jun-1999)
*/
public void setAlign(String newValue);
public String getAlign();
/**
* 'columns' specifies the number of columns
* (Section 11.8.5, WAP WML Version 16-Jun-1999)
*/
public void setColumns(int newValue);
public int getColumns();
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'td' specifies a single table cell with in a row
* (Section 11.8.6, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLTdElement extends WMLElement {
/**
* The xml:lang that specifics the natural or formal language in
* which the document is written.
* (Section 8.8, WAP WML Version 16-Jun-1999)
*/
public void setXmlLang(String newValue);
public String getXmlLang();
}

View File

@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>The 'template' element declares a template for the cards in the deck.</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLTemplateElement extends WMLElement {
public void setOnTimer(String newValue);
public String getOnTimer();
public void setOnEnterBackward(String newValue);
public String getOnEnterBackward();
public void setOnEnterForward(String newValue);
public String getOnEnterForward();
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'timer' elements declares a card timer.
* (Section 11.6.7, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLTimerElement extends WMLElement {
/**
* 'name' specifies the name of variable ot be set with the value
* of the timer.
* (Section 11.6.7, WAP WML Version 16-Jun-1999)
*/
public void setName(String newValue);
public String getName();
/**
* 'value' indicates teh default of the variable 'name'
* (Section 11.6.7, WAP WML Version 16-Jun-1999)
*/
public void setValue(String newValue);
public String getValue();
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.wml;
/**
* <p>The interface is modeled after DOM1 Spec for HTML from W3C.
* The DTD used in this DOM model is from
* <a href="http://www.wapforum.org/DTD/wml_1.1.xml">
* http://www.wapforum.org/DTD/wml_1.1.xml</a></p>
*
* <p>'tr' specifies a single row
* (Section 11.8.6, WAP WML Version 16-Jun-1999)</p>
*
* @version $Id$
* @author <a href="mailto:david@topware.com.tw">David Li</a>
*/
public interface WMLTrElement extends WMLElement {
}

Some files were not shown because too many files have changed in this diff Show More