# Avoided if we are using Windows so that we can specify the directory to find the libxml DLL.
# useDynLib(XML)

#exportPattern(".*")
export(
 append.xmlNode,
 append.XMLNode,
 Doctype,
 asXMLNode,
 comment.SAX,
 dtdElement,
 dtdElementValidEntry,
 dtdEntity,
 dtdIsAttribute,
 dtdValidElement,
 endElement.SAX,
 entityDeclaration.SAX,
 genericSAXHandlers,
 getNodeSet,
 xpathApply,
 htmlTreeParse,
 htmlParse,       
 libxmlVersion,
 xmlDoc,
 newXMLDoc,
 newXMLNode,
 newXMLNamespace,
 newXMLPINode,
 newXMLTextNode,
 newXMLCommentNode,
 newXMLCDataNode,
 newXMLDTDNode,       
 parseDTD,
 processingInstruction.SAX,
 saveXML,
 startElement.SAX,
 supportsExpat,
 supportsLibxml,
 text.SAX,
 toString.XMLNode,
 xmlApply,
 xmlAttributeType,
 xmlAttrs,
 "xmlAttrs<-",       
 xmlCDataNode,
 xmlChildren,
 xmlCommentNode,
 xmlContainsElement,
 xmlContainsEntity,
 xmlDOMApply,
 xmlElementsByTagName,
 xmlEventHandler,
 xmlEventParse,
# new.xmlEventParse,
# new.xmlTreeParse,              
 xmlGetAttr,
 xmlHandler,
 xmlName,
 xmlNamespace,
 xmlNode,
 xmlOutputBuffer,
 xmlOutputDOM,
 xmlPINode,
 xmlParent,
 xmlAncestors,       
 xmlRoot,
 xmlSApply,
 xmlSize,
 xmlSize.default,
 xmlTextNode,
 xmlTree,
 xmlTreeParse,
 xmlInternalTreeParse,
 xmlNativeTreeParse,
 xmlParse,              
 xmlValue,
 names.XMLNode,
 parseURI,
 asXMLTreeNode,
 xmlHashTree,
 addNode,
 xmlNamespaceDefinitions,
 xmlNamespaces,
 matchNamespaces,
 getDefaultNamespace,
 catalogResolve,
 toHTML,
 addChildren,
 removeChildren,
 removeNodes,       
 addAttributes,
 removeAttributes,
 "xmlName<-",
  addSibling
# xmlFlatListTree       
)

exportMethods("addAttributes", "removeAttributes")

exportMethods("toHTML")

export("xmlChildren<-")
exportMethods("xmlChildren<-")

exportClasses("XMLInternalDocument")
exportClasses("XMLAbstractNode", "XMLNode", "XMLInternalNode", "XMLInternalElementNode",
              "XMLInternalTextNode", "XMLInternalPINode", "XMLInternalCDataNode",
              "XMLInternalCommentNode", "XMLDTDNode",
              "XMLXIncludeStartNode", "XMLXIncludeEndNode", "XMLEntityDeclNode",
              "XMLAttributeDeclNode", "XMLDocumentNode", "XMLDocumentTypeNode",
              "XMLDocumentFragNode", "XMLNamespaceDeclNode")

exportClasses("XMLNamespace")

exportClass("URI")


exportMethods("coerce")

exportMethods("free")

S3method(removeChildren, XMLNode)
S3method(removeChildren, XMLInternalNode)


S3method(xpathApply, XMLInternalNode)
S3method(xpathApply, XMLInternalDocument)
export(xpathSApply)


S3method(xmlNamespaceDefinitions, XMLNode)
S3method(xmlNamespaceDefinitions, XMLInternalDocument)
S3method(xmlNamespaceDefinitions, XMLInternalNode)
S3method(xmlNamespaceDefinitions, XMLAbstractDocument)
#XXX S3method(xmlNamespaceDefinitions, XMLHashTreeNode)

#S3method(names, XMLFlatTree)
#S3method("$", XMLFlatListTree)

S3method(addNode, XMLHashTree)
S3method(xmlRoot, XMLHashTree)
S3method(print, XMLHashTree)

S3method(print, XMLInternalDocument)
S3method(print, XMLInternalNode)

S3method(print, XMLRDocument)
S3method(xmlRoot, XMLRDocument)
S3method(xmlRoot, HTMLDocument)


if(TRUE) {
S3method(xmlName, XMLComment)
S3method(xmlName, XMLNode)
S3method(xmlName, XMLInternalNode)
} else
  # S4 version
exportMethods(xmlName)
  
S3method("names<-", XMLNode)
S3method("xmlName<-", XMLNode)
S3method("xmlName<-", XMLInternalElementNode)





exportMethods("xmlAttrs<-")


if(TRUE) {
S3method(xmlChildren, XMLTreeNode)
S3method(xmlChildren, XMLInternalDocument)
S3method(xmlChildren, XMLHashTreeNode)
S3method(xmlChildren, XMLNode)
S3method(xmlChildren, XMLInternalNode)
} else
  exportMethods("xmlChildren")

S3method(xmlParent, XMLTreeNode)
S3method(xmlParent, XMLHashTreeNode)
S3method(xmlParent, XMLInternalNode)
S3method(xmlSize, XMLHashTreeNode)


S3method(xmlSize, XMLHashTree)
S3method(xmlRoot, XMLHashTree)


S3method(xmlRoot, XMLInternalDOM)
S3method(xmlRoot, XMLInternalNode)


S3method(addChildren, XMLInternalNode)
S3method(addChildren, XMLInternalDocument)
S3method(addChildren, XMLNode)


export(replaceNodes)
S3method(replaceNodes, XMLInternalNode)



S3method(xmlSize, XMLInternalNode)


S3method(xmlValue, XMLInternalNode)

# exportS3method("xmlValue", "NULL")



S3method("[", XMLNode)
S3method("[[", XMLNode)
S3method("[[", XMLDocumentContent)

S3method("[[", XMLInternalNode)
S3method("[", XMLInternalNode)

S3method("[", XMLInternalDocument)
S3method("[[", XMLInternalDocument)
S3method("names", XMLInternalNode)

S3method("[[", XMLHashTreeNode)

S3method("[<-", XMLNode)
S3method("[[<-", XMLNode)

S3method("[[<-", XMLInternalNode)


S3method(names, XMLNode)
S3method(length, XMLNode)

if(TRUE) {
 S3method(xmlAttrs, XMLNode)
 S3method(xmlAttrs, XMLInternalNode)
 S3method(xmlAttrs, XMLElementDef)
} else
  exportMethods("xmlAttrs")


S3method(xmlSize, XMLDocument)
S3method(xmlSize, default)
S3method(xmlSize, XMLNode)

S3method(print, XMLNode)
S3method(print, XMLTextNode)
S3method(print, XMLComment)
S3method(print, XMLCommentNode)
S3method(print, XMLEntityRef)
S3method(print, XMLCDataNode)
S3method(print, XMLProcessingInstruction) 


S3method(xmlRoot, XMLDocument)
S3method(xmlRoot, XMLInternalDocument)
S3method(xmlRoot, XMLDocumentContent)

S3method(xmlApply, XMLNode)
S3method(xmlApply, XMLDocument)
S3method(xmlApply, XMLDocumentContent)
S3method(xmlApply, XMLInternalNode)

S3method(xmlSApply, XMLNode)
S3method(xmlSApply, XMLDocument)
S3method(xmlSApply, XMLDocumentContent)
S3method(xmlSApply, XMLInternalNode)

if(TRUE) {
S3method(xmlValue, XMLNode)
S3method(xmlValue, XMLTextNode)
S3method(xmlValue, XMLComment)
S3method(xmlValue, XMLCDataNode)
S3method(xmlValue, XMLProcessingInstruction)
} else
 exportMethods("xmlValue")

S3method(addSibling, XMLInternalNode)

S3method(xmlNamespace, XMLNode)
S3method(xmlNamespace, XMLInternalNode)
S3method(xmlNamespace, character)

# No effect if append is not generic.
S3method(append, XMLNode)

S3method(saveXML, XMLInternalDocument)
S3method(saveXML, XMLInternalDOM)
S3method(saveXML, XMLInternalNode)
S3method(saveXML, XMLOutputStream)
S3method(saveXML, XMLNode)
S3method(saveXML, XMLFlatTree)

S3method(dtdElementValidEntry, XMLElementDef)
S3method(dtdElementValidEntry, XMLOrContent)
S3method(dtdElementValidEntry, XMLElementContent)
S3method(dtdElementValidEntry, character)
S3method(dtdElementValidEntry, XMLSequenceContent)

export(docName)
S3method(docName, XMLDocument)
S3method(docName, XMLDocumentContent)
S3method(docName, XMLInternalDocument)
S3method(docName, XMLInternalNode)
S3method(docName, XMLHashTree)


export("xmlNamespaces<-")
exportMethods("xmlNamespaces<-")


export("docName<-")
exportMethods("docName<-")


exportClass("SAXState")

export(xmlSource)
exportMethods("xmlSource")

# Not yet exported....
#xmlValidity

if(TRUE) {
exportClasses("ExternalReference", "xmlSchemaRef", "libxmlTypeTable")
exportClasses("SchemaElementTable", "xmlSchemaElementRef",
              "SchemaTypeTable", "xmlSchemaTypeRef",
	      "SchemaAttributeTable", "xmlSchemaAttributeRef",
              "SchemaAttributeGroupTable", "xmlSchemaAttributeGroupRef",
              "SchemaNotationTable", "xmlSchemaNotationRef")

export(xmlSchemaValidate, schemaValidationErrorHandler, xmlSchemaParse)

exportMethods("names", "$", "$<-", "coerce")
}



#importFrom(utils, normalizePath)

export(getSibling)
S3method(getSibling, XMLInternalNode)
S3method(getSibling, XMLHashTreeNode)
export(catalogLoad, catalogClearTable, catalogAdd)


export(xmlStructuredStop, xmlErrorCumulator) # xmlStop
export(xmlStopParser)
export(getXMLErrors)

export(processXInclude)
S3method(processXInclude, list)
S3method(processXInclude, XMLInternalDocument)
S3method(processXInclude, XMLInternalElementNode)

exportMethods(show)

export(xmlElementSummary)
#, xmlElementSummaryHandlers)

#export(xmlNodeMatch)
#export(getRCode)


export(xmlParserContextFunction)

export(getRelativeURL)



export(xmlToList)
exportClass("XMLNamespaceDefinitions")

export('xmlValue<-')
exportMethods('xmlValue<-')

