Update ooo320-m1
[ooovba.git] / unoxml / source / dom / documenttype.cxx
blob6c577a2f2ecf79af6bc54fad897689fdb92ab07f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documenttype.cxx,v $
10 * $Revision: 1.6 $
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"
35 #include <string.h>
37 namespace DOM
40 CDocumentType::CDocumentType(const xmlDtdPtr aDtdPtr)
42 m_aNodeType = NodeType_DOCUMENT_TYPE_NODE;
43 m_aDtdPtr = aDtdPtr;
44 init_node((xmlNodePtr)aDtdPtr);
47 /**
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));
58 return aMap;
61 /**
62 The internal subset as a string, or null if there is none.
64 OUString SAL_CALL CDocumentType::getInternalSubset() throw (RuntimeException)
66 // XXX
67 return OUString();
70 /**
71 The name of DTD; i.e., the name immediately following the DOCTYPE
72 keyword.
74 OUString SAL_CALL CDocumentType::getName() throw (RuntimeException)
76 OUString aName;
77 if (m_aDtdPtr != NULL)
79 aName = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->name), RTL_TEXTENCODING_UTF8);
81 return aName;
84 /**
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));
94 return aMap;
97 /**
98 The public identifier of the external subset.
100 OUString SAL_CALL CDocumentType::getPublicId() throw (RuntimeException)
102 OUString aId;
103 if (m_aDtdPtr != NULL)
105 aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->ExternalID), RTL_TEXTENCODING_UTF8);
107 return aId;
111 The system identifier of the external subset.
113 OUString SAL_CALL CDocumentType::getSystemId() throw (RuntimeException)
115 OUString aId;
116 if (m_aDtdPtr != NULL)
118 aId = OUString((sal_Char*)m_aDtdPtr->name, strlen((char*)m_aDtdPtr->SystemID), RTL_TEXTENCODING_UTF8);
120 return aId;
122 OUString SAL_CALL CDocumentType::getNodeName()throw (RuntimeException)
124 return getName();
126 OUString SAL_CALL CDocumentType::getNodeValue() throw (RuntimeException)
128 return OUString();