1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documenttype.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "documenttype.hxx"
32 #include "entitiesmap.hxx"
33 #include "notationsmap.hxx"
40 CDocumentType::CDocumentType(const xmlDtdPtr aDtdPtr
)
42 m_aNodeType
= NodeType_DOCUMENT_TYPE_NODE
;
44 init_node((xmlNodePtr
)aDtdPtr
);
48 A NamedNodeMap containing the general entities, both external and
49 internal, declared in the DTD.
51 Reference
< XNamedNodeMap
> SAL_CALL
CDocumentType::getEntities() throw (RuntimeException
)
53 Reference
< XNamedNodeMap
> aMap
;
54 if (m_aDtdPtr
!= NULL
)
56 aMap
= Reference
< XNamedNodeMap
>(new CEntitiesMap(this));
62 The internal subset as a string, or null if there is none.
64 OUString SAL_CALL
CDocumentType::getInternalSubset() throw (RuntimeException
)
71 The name of DTD; i.e., the name immediately following the DOCTYPE
74 OUString SAL_CALL
CDocumentType::getName() throw (RuntimeException
)
77 if (m_aDtdPtr
!= NULL
)
79 aName
= OUString((sal_Char
*)m_aDtdPtr
->name
, strlen((char*)m_aDtdPtr
->name
), RTL_TEXTENCODING_UTF8
);
85 A NamedNodeMap containing the notations declared in the DTD.
87 Reference
< XNamedNodeMap
> SAL_CALL
CDocumentType::getNotations() throw (RuntimeException
)
89 Reference
< XNamedNodeMap
> aMap
;
90 if (m_aDtdPtr
!= NULL
)
92 aMap
.set(new CNotationsMap(this));
98 The public identifier of the external subset.
100 OUString SAL_CALL
CDocumentType::getPublicId() throw (RuntimeException
)
103 if (m_aDtdPtr
!= NULL
)
105 aId
= OUString((sal_Char
*)m_aDtdPtr
->name
, strlen((char*)m_aDtdPtr
->ExternalID
), RTL_TEXTENCODING_UTF8
);
111 The system identifier of the external subset.
113 OUString SAL_CALL
CDocumentType::getSystemId() throw (RuntimeException
)
116 if (m_aDtdPtr
!= NULL
)
118 aId
= OUString((sal_Char
*)m_aDtdPtr
->name
, strlen((char*)m_aDtdPtr
->SystemID
), RTL_TEXTENCODING_UTF8
);
122 OUString SAL_CALL
CDocumentType::getNodeName()throw (RuntimeException
)
126 OUString SAL_CALL
CDocumentType::getNodeValue() throw (RuntimeException
)